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

2013/12/10

Life Counter Aid

GeicoCoder GeicoCoder

2013/12/10

#
Hi, I'm making a Mario themed Breakout game for my coding class, but I have a problem. I don't know how to add lives. My Breakout "ball" is a mushroom and my "blocks" are coins. I would like to have five lives for my mushroom, so that whenever the ball goes out the bottom of the screen I loose a life. Much help is appreciated!
danpost danpost

2013/12/10

#
'Lives': it is more of a game thing than a Ball or Mushroom thing; that is, it belongs more to the 'user' than to any specific object within your scenario. A mushroom or ball can be re-used or replaced so many times for the user. My point is that the field to track the lives should probably go in your world class. When no mushrooms (or balls) are in your world, you can decrease its value, check it for zero to perform a game over routine, and add a new one and adjust any actor that displays its value if not game over.
You need to login to post a reply.