PDA

View Full Version : A drag race game


DickBaldwin
10-16-2007, 01: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/Alice0930.htm#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.

ottosparks
11-19-2007, 03:50 PM
I can't find the Download link on there.... can you add a direct download link HERE?

lanceA
11-19-2007, 07:35 PM
I've already used it in a class Dick. It led to some good discussions. Thanks for sharing.

DickBaldwin
11-19-2007, 07:38 PM
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
11-19-2007, 07:43 PM
I can't find the Download link on there.... can you add a direct download link HERE?

Go to the following URL:

http://www.dickbaldwin.com/alice/Alice0930.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

ottosparks
11-20-2007, 07:13 AM
Go to the following URL:

http://www.dickbaldwin.com/alice/Alice0930.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....