As a normal Doodle Jump Game, the doodle jumps, however, the game is sideways.
As for a unique power up, when Doodle touchs a Car, it allows the player to "driver" (move) the car (image with doodle in a car). Since this is a power up, it could only be use for a certain time.
Here is what I have so far, this is written in my Car Class:
I know I definitely mess something up, like the "isTouching" method, and something else, probably the order of my code; however, I have no idea how to fix it. If you can help with a example of the code, that will be helpful and I will really appreciate it!
private final int carDuration=10;
private int carTime;
public void act()
{
move();
checkCar();
}
public void checkCar()
{
if(isTouching(Doodle.class))
{
removeTouching(Doodle.class);
checkKeys();
carTime = carDuration;
} else if(carTime > 0)
{
if(--carTime==0)
{
int x = getOneIntersectingObject(Car.class).getX();
int y = getOneIntersectingObject(Car.class).getY();
Doodle doodle = new Doodle();
getWorld().addObject(doodle, x, y);
}
}
}
public void checkKeys()
{
if(Greenfoot.isKeyDown("right"))
{
moving(true);
}else moving(false);
if(Greenfoot.isKeyDown("up"))
{
setLocation(getX(), getY() - 5);
}
if(Greenfoot.isKeyDown("down"))
{
setLocation(getX(), getY() + 5);
}
}
public void moving(boolean movingFoward)
{
if(movingFoward == true)
{
setImage("CarDoodle.png");
move(5);
}else
{
setImage("DoodleInCar.png");
}
}
}
