Project 15

Traffic Dodge

What’s a desert frog to do when faced with racing cars, speeding motorcycles, and oh-so-slow camels? That’s what your player must contend with while crossing busy highways in Traffic Dodge!

In this project, you build your own Frogger-style game that includes levels. You build game pages — both Level 1 and Level 2. These are the pages where the player plays the game. Then you create a splash page — a page that introduces your game and gives a backstory.

The player controls the frog by using keyboard controls. If the jumping frog and a vehicle collide, the hit is announced, and the frog shape changes to appear squished. Also, the game has a variable that indicates lives remaining — each hit subtracts one life, and when the player runs out of lives, the game is over. Get jumping!

tip.eps In the classic version of Frogger, game play is more complicated: You must first dodge traffic, and then jump onto lily pads to avoid drowning in the raging river. Here, you need only worry about programming a game in which the frog must avoid getting squished by vehicles and other moving objects.

Brainstorm

Don’t feel limited to jumping a frog through obstacles. You can choose any "mark" to move through any obstacle:

  • An iPod-wearing vocalist being bombarded with music notes as he attempts to reach his recording session unscathed
  • A germ-evading, white-blood-cell trooper as it moves ...

Get Coding For Kids For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.