Alice Community A drag race game

 A drag race game
DickBaldwin
Guest

Status:
Posts: n/a
A drag race game - 10-16-2007, 02:37 PM

In case anyone is interested, I have written a drag race game. You can read about it and download the world at http://www.dickbaldwin.com/alice/Ali...Drag_race_game

Drag race game at startup
Two cars are at the starting line with instructions to the user to click on a car to start the race. By clicking a particular car, the player not only starts the race, but also predicts which car will win the race.

The Christmas tree lights

From what I read, drag races are started by running a drag strip "Christmas tree" through several colors of lights with the green light being the signal to start moving down the track. When the user clicks on one of the cars, a simulated drag strip "Christmas Tree" cycles through red, yellow, and green.

Go on green
When the Christmas tree turns green, the two cars start moving down the track. A while loop and a random number generator are used to control the motion of each car. During each iteration of the while loop, each car moves forward by a random distance ranging from 0.5 to 1.5 meters.

Crossing the finish line
When a car crosses the finish line during an iteration of the while loop, the loop terminates and the motion of both cars stops. The winner is determined to be the car that went the greatest distance beyond the finish line before stopping.

And the winner is ...
Text at the bottom of the world shows which car won, and also shows whether or not the player correctly predicted the winner by clicking on the car that won the race.
Attached Files
 DragRace01.a2w (394.8 KB, 1387 views)

Last edited by DickBaldwin; 11-25-2007 at 03:43 PM. Reason: Upload the a2w file now that upload is working.

 Uhhhhh..
 lanceA Guest   Status: Posts: n/a 11-19-2007, 08:35 PM I've already used it in a class Dick. It led to some good discussions. Thanks for sharing. Last edited by lanceA; 11-19-2007 at 08:36 PM. Reason: Typos
DickBaldwin
Guest

Status:
Posts: n/a
11-19-2007, 08:38 PM

Quote:
 Originally Posted by lanceA I've already used it in a class Dick. It led to some good discussions. Thanks for sharing.
You're welcome.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm

DickBaldwin
Guest

Status:
Posts: n/a
11-19-2007, 08:43 PM

Quote:
Go to the following URL:

http://www.dickbaldwin.com/alice/Ali....htm#Resources

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm

Last edited by DickBaldwin; 11-19-2007 at 08:48 PM.

ottosparks
Senior Member

Status: Offline
Posts: 117
Join Date: Mar 2007
Location: here
11-20-2007, 08:13 AM

Quote:
 Originally Posted by DickBaldwin Go to the following URL: http://www.dickbaldwin.com/alice/Ali....htm#Resources Click on the link that reads "Download the Alice a2w files for the sample programs presented in this appendix." Dick Baldwin Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm Free programming tutorials: http://www.dickbaldwin.com/toc.htm
Thanks!

Mommy.... the train went swimming in the piano....

I'm more lopsided than a three-legged badger!

 myfadingmuse Guest   Status: Posts: n/a 08-31-2010, 03:43 AM Hi Dick, I showed this to my Grade 10 programming class, I got them to try and think about how you would have written the code for the drag race and it was a great activity to do! The kids loved it! Thank you so much for sharing this great Alice creation!

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops     Alice Player and VR General Discussion     Questions and Comments     The Lounge