Excerpt from Description of Exercise

Objective: To gain experience with loops and active objects.

The Scenario.

For this lab, we would like you to write a program that plays the game Frogger. In this game, you control a frog that is trying to cross a busy 4-lane highway. Each lane has cars or trucks zooming by. The vehicles in a given lane all travel at the same speed, but vehicles in different lanes may travel at different speeds (and even in different directions if you would like). The user is in control of a frog. Clicking in front of the frog moves it forward one hop (one hop is the width of a lane of traffic), clicking behind moves it back, and similarly for clicking to the left and right of it. The goal is for the user to get the frog across the highway without it getting squished.

If the frog does get squished it should display an ``OUCH!'' message at the bottom of the screen. The user should be able to restart the frog from its original starting position by clicking the mouse once in the area below the lanes of the highway.

Handouts Describing the Exercise

Student Resources for Lab Exercise

Sample solutions