All the cars move at the same time. I would also like to know how can I make the car a picture. I have this gif file of a car which is perfect for the game. Thank you
[code=java]
final int WIDTH = 800;
final int HEIGHT = 400;
final int SHOULDER_HEIGHT = 50;
final int MARKER_HEIGHT = 10;
final int LANE_MARKER_COLOR = color(240);
final int EXTENDED_SHOULDER_HEIGHT =
SHOULDER_HEIGHT + MARKER_HEIGHT + MARKER_HEIGHT / 2;
final int DRIVEABLE_HEIGHT =
HEIGHT - 2 * EXTENDED_SHOULDER_HEIGHT;
final int LANE_MARKER_WIDTH = 80;
final int NUMBER_OF_LANES = 4;
final color SHOULDER_COLOR = color( 0, 112, 0);
final color ROAD_COLOR = color( 64);
final color ROAD_MARKER_COLOR = color( 240, 230, 20);
final color RED = color(255, 0, 0);
final color GREEN = color(0, 255, 0);
final color YELLOW = color(255, 255, 0);
final float LINE_THICKNESS = 15.0;
Car c1, c2, c3, c4;
Frog frog;
void setup()
{
//3 Cars setup.
size(WIDTH, HEIGHT);
noStroke();
c1 = new Car(100);
c2 = new Car(165);
c3 = new Car(233);
c4 = new Car(300);
frog = new Frog();
textSize(25);
}
void draw()
{
drawRoadway();
drawCars();
frog.draw();
fill(255);
text("Use the Arrow Keys to Play the Game", 10, 30);