Creating the maximum life possible
Let's create another Global Variable called maxLife; like the name says, it's supposed to set your maximum possible health at that moment. Set it to some number and follow the code below.
- Note the use of sub-events. These are very important and powerful; they are very good for readability too.
Test your code inputting something bigger than your maxLife. If it goes as the figure shows, you're good to move on.
Now let's create our actual heart sprites. You might have some ready there, but I made a couple squares. :P
- Remember the name of the animations. You can call them whatever you want, but you'll use those names in the event sheet later.
- Check where I put the image points on both frames ([0,0] or Top-Left). Image Points are always important things to check when you create a new Sprite object, specially the Origin image point.
- I made these 32x32 but they can be any size you want for this tutorial.