The Racing Game

See inside

Click the flag to start

Red car: Speed up = up arrow
Turn right = right arrow
Turn left = left arrow
Slow down = down arrow

Green car: Speed up = w key
Turn right = d key
Turn left = a key
Slow down = s key
NOTES: You CANNOT go in reverse. That prevents someone from winning just by backing over the finish line from the starting position ;-) There is NO acceleration until the green light shines -- Speed is set to 0 on both cars until that happens ;)

Notes and Credits

Based on a project created by

Check their page out for more fun project ideas.

YES -- the control loops should be in one Forever loop. I did it this way on purpose, as a teaching tool.

Theme music courtesy of Incompetech (


5/2/14: Added a Game Over screen.

4/17/14: LONG time since I've done anything on this! I have added a title screen and theme music - both at the title screen AND while you are racing!!! Working on improving the wrecker system -- I'm thinking each car will have it's own wrecker. I am also considering a damage system so that cars don't wreck the first time they run off the track.

3/12/14: Inspired by one of my students, I have added a wrecker that will remove crashed cars from the track. Easier than it sounds ;)

11/13/13: Fixed an inadvertent error that made both cars crash when one hit the wall.
11/6/13 -- In honor of my upcoming 500th view for this project, I have created Track 6 -- and I think it's the toughest one yet!
10/28/13 part 2 -- I have implemented timer-based scoring, so you can post your best lap time in the comments and see which Scratcher is the best racer on each track. Coming soon -- a leaderboard!!
10/28/13 -- I THINK the problem with the cheat wall mentioned in the comments has been fixed. If you have any further problems, let me know which track you are trying to race on, and which track you raced on the previous time (if any) so I can see if that is what causes the bug. Thanks!!
10/16/13 -- Added two new tracks (4 and 5 are actually mirror images of 1 and 3). This didn't work well at first, but it is working fine now.
10/15/13 -- Fixed the "reverse exploit" mentioned in the comments. Thanks for the feedback!! Also added starter lights and sound for it.
10/14/13 -- Added one new track (Track 3 - the hardest one yet!), and some CRASH sound effects
10/11/13 -- JUST ADDED: if you run into the other car, BOTH cars burst into flame and the race is OVER. When a car runs off the track and crashes, it clears after a few seconds (consider this a yellow flag!). There are also TWO tracks now -- you can select either track 1 or track 2 at the beginning of the game. ENJOY!!!

Shared: 9 Oct 2013 Modified: 23 Mar 2017
Favorite this project 484
Love this project 543
Total views 84904
View the remix tree  404
More projects by wkelly42