Programming A Frogger Game
Complete the Khan Lessons. This assignment assumes you have completed the lesson that takes you through the Khan Academy tutorials assigned to you. Your teacher will track that you did all of tutorials by looking for the green circles for each tutorial that you will see linked vertically on the right of the Khan tutorial pages. There are points for this assignment for doing the tutorials assigned to you.
Make A Hoppy Frogger Game. One of the original video games was Frogger, a game where you try to get a frog across a busy street without getting hit by a car, and then jump on logs to cross a river. Write a program that is similar to the first part - getting across the street. To do this, use the final Hoppy Beaver code in the Khan tutorials, including the key presses keeping Hoppy up, and having Hoppy fall if a key is not pressed. Then modify the code to:
- Remove the grass so that the bottom of the screen just has a brown, stationary, bar as the side of the road.
- Turn the sticks horizontally to represent the cars.
- The sides of the road are the brown bar at the bottom, and also the top of the screen (no object - just the top of the screen).
- Add one to the score for each time Hoppy crosses the street: i.e. goes from the bottom to the top, or vice versa. Note that Hoppy must alternate getting to the top, then bottom, then top, then bottom, etc. That is, do not award a point for two consecutive tops, or two consecutive bottoms.
- If Hoppy is hit by a car: make the car disappear, subtract one from the score, have Hoppy remain in place and the game goes on.
- Have the game stop after 100 cars.
- Take out the check for winning that was in Khan's original game - that does not apply in this Frogger game.
- Add Khan's Button class. Create an instance of Khan's Button class that starts the game. After starting, the button should change to a Pause button that when clicked, causes the gsme to pause and becomes again a Start button to re-start it.
- Make the game have two scenes: an opening splash screen, and the game itself. The opening splash screen will have the title of the game, your name as author, and a start button. You may add other decoration to the splash screen if you wish - but it must have this, and must not be the game screen itself. Use the techniques for scene change from the Khan lessons. Use the code for a button (either a simple button, or the button object type) from Khan.
Note that there are points in all programs for your use of style:
- Comments
- Indenting and white space
- CamelCase names for variables (including functions) and parameters.
- Descriptive name for variables (including functions) and parameters.
- Use of functions to break code up
- Minimal use of global variables (instead using function parameters and local variables)
- Proper grouping of code into objects.
Save this program at Khan with the name lastname_frogger.