Good night to everyone.
I am currentlyy working on a game, where if the spaceship gets hit 3 times, it disappears. The thing, is that I don't know why it doesn't work.
Here is the code:
I also want an explosion to occur when the obstacle gets hit (I already have the bit where the obstacle/asteroid disappears).
I have created a gif image using GIMP 2, which I would also like to come up.
any ideas?
Thanks in advance :)
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 | private boolean Kaputt = false ; public void takeDamage() { Actor Obstacle; Obstacle = getOneObjectAtOffset( 0 , 0 , Obstacle. class ); Actor Rocket; Rocket = getOneObjectAtOffset( 0 , 0 , rocket. class ); if (Obstacle!= null ) { removeTouching(Obstacle. class ); damage = damage+ 1 ; if (damage > 3 ){ Kaputt = true ; } World world; if (Kaputt = true ){ world = getWorld(); world.removeObject( this ); } } } |