This site requires JavaScript, please enable it in your browser!
Greenfoot back
Frost
Frost wrote ...

2015/1/6

Game over when hit 3 times

Frost Frost

2015/1/6

#
I want to link the world to a gameover screen after losing 3 lives when hitting another actor. How can you do this? Thank you!
danpost danpost

2015/1/6

#
What have you tried? Use the 'code' link below the reply box to insert code into your posts. Thank you!
DiplomatikCow DiplomatikCow

2015/1/6

#
I figured it out, got it all solved. I guess I was just being impatient, didn't have the greatest day... :P
Frost Frost

2015/1/6

#
public int healthPoint; public void lifePoints(){ Actor player = getOneIntersectingObject(Enemy.class); if(player != null) { healthPoint++; } if(damagePoint>=3) { GameOverScreen(); } }
danpost danpost

2015/1/6

#
I do not think you are being consistent with the name of your field. I see 'healthPoint' as the name of the field; but I also see 'damagePoint' being used in the code. I think 'hitCount' might be a more appropriate name since hits are what it is counting.
You need to login to post a reply.