Race Against Johnny
To Summarize: The green car
in the middle of the screen is Johnny's car. The yellow one is yours. Johnny's
car is always maintained in the middle of the screen. If you look at the
white fence posts screaming by above and below the road you can get an
idea of how fast Johnny is moving. When a car drives off the front or back
of the screen it will reappear at the opposite end, pretty much as if the
two ends where joined to make a loop.
There are a few things you can modify:
There are a few anomolies too:
# of Cars: There have to be at least two cars, there
can be as many as you want.
Following Distance: How much risk do you want the
cars to take? The smaller the following distance the closer the cars will
follow, and the riskier the driving will be. Luckily everyone is driving
Nerf cars, so accidents don't cause an explosion or anything. They still
slow traffic down though.
# of Lanes: There will always be at least two lanes,
you can add more to make up to nine.
Ambulances/Pace Cars: Are you and Johnny driving
ambulances or pace cars? The difference is in the allowable maximum speed.
The pace cars will only go about as fast as the fastest of the other cars.
The ambulances want to reach the speed of sound.
Auto Drive/User Drive: You can have the computer
drive your car. This is probably the most fair mode to use if wagering
is involved. When you are driving your car there will be two extra buttons,
"<-" and "->", used to change lanes. Even in user drive mode the speed
of your car will be automatically controlled.
Lap Count: This records the lap of your car compared
to Johnny's car. You can make this lap count go up by becoming more skilled.
I do plan on working on this more, so if you have
any bug reports or suggestions
let me know.
Cars off the screen: The game will only let a car
reenter the screen (after moving off of it at either end) when it is safe
to do so (i.e. when it can enter the lane while maintaining the following
distance with the car in front and behind it). Because of this, the number
of cars on the screen may be less than the total number of cars desired.
For the sake of "fairness" though, your car will never get jammed up in
some long list of cars trying to get back in a lane. It is given the first
Light speed: When driving the ambulances the cars
can get going so much faster than any of the blue cars that it would never
be safe for the blue car to reenter that lane. At which point the game
becomes boring, as the ambulance will just scream along at a thousand miles
an hour for ever. When this happens just hit the "New Game" button and
refund yourself your quarter.
No radio buttons: I should have used radio buttons
for choosing between UserDrive/AutoDrive and Ambulance/PaceCar, those things
where there is a list and you can only select one item. But, I couldn't
be bothered figuring out how to do that. This is my first Java program
though, so maybe I will eventually.
back to the