I need to do a life counter for my game and i don't understand how i can make it so when a life is gone an image will go off the screen to represent lives. Help?
I can think of two ways to go about this:
(1) have one actor that will have an int field for lives and an image large enough to hold the maximum number of life images; have its image display the number of life images that the value of the int field holds
(2) have multiple life actors whose number of them in the world represents the number of lives; you will have to keep track of them either in an array or by their location
I prefer the first way. It is like a basic counter, but with a different kind of display. And keeping track of one absolute actor is much easier than trying to keep track of many possible actors.
This all comes down to (1) how you create your world (2) what is involved in resetting after losing a life (3) possibly other things.
If you can get away with just relocating your player instead of removing it from the world, that would be one solution. Will at least need to see the code where the player loses a life and possibly the entire class of the player (to start). Plus, would need to know exactly what you want done with the player when a life is lost.