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!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 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" ); } } } |