I am making a game where you have to jump over the cars. (It's my first game)
But I add the cars with a number of direction.
With that direction I give it the way it should go, but it spawns on the wrong site and moves the wrong way.
I still don't know what goes wrong.
All help is welcome.
/**
* Spawns Cars
*/
public void spawnCar()
{
if(Greenfoot.getRandomNumber(1000) % 19 == 0)
{
if(Greenfoot.getRandomNumber(250) % 5 == 0)
{
if(steps >= rememberSteps)
{
direction = Greenfoot.getRandomNumber(2);
rememberSteps = steps + Greenfoot.getRandomNumber(100) +50;
if(direction == 1)
{
getWorld().addObject(new Car(direction), 950, 425);
}else if(direction == 0)
{
getWorld().addObject(new Car(direction), 50, 425);
}
}
}
}
steps++;
}public void makeMove(int direction)
{
if(steps == 0)
{
speed = Greenfoot.getRandomNumber(10)+5;
}
if(direction == 1)
{
move(speed-speed-10);
}else if(direction == 0)
{
move(speed);
}
}

