Game Development Reference
Select the player to create a collision and send a message to barlife with
Decrease barlife if you get a message from player
Have a go hero - making limits
We have explained how to decrease the health bar due to collisions. However, wouldn't it be
interesing to create a health bar yourself, wherein the health increases when your character
gets food or certain objects?
I think it's a bit like thinking you will find a way to increase the life bar. Just use the same
logic bricks with a posiive value.
But what if you already have a full life bar, or vice versa, your life bar is empty. You will find
very useful informaion if you said the sensor to use is Property, and the property chooses
Lifep and you give a value of 0 . With this informaion, you can connect the bricks so that
the actuator chosen in the game quits the game, or if you prefer another scene, it selects a
new scene as the end of the game.
Creating a counter of items collected
Like the life bar, we can find a counter or some objects, such as onscreen icons, to show us
what we have achieved. Imagine that the whale can get floaters and these are displayed on
screen. Let's see how to get it.
Time for action - collecting
The process is always the same: we have a collision in order to prove that the player really
has got the medal, trophy, or in our case, the iceberg. To do this, we must create a collision
after appending the whale in our new scene by performing the following steps: