One of the easy ways to do this is by adding Health and Damage Component. Let me show you how.
I'm Selecting a Platformer game as an example.
On the next page, click your character on the assets panel.
And then click Add Component on the options panel to your right then select Health. This is also where you can find Damage option.
After selecting it, you will have the option to put a variable on both of them. The number will represent the number of enemy collision before you die.
Now let us talk about adding a Health bar.
Let us start by going to www.glyphrstudio.com/online/.
And type Health Bar as the Project name then click Start a new font from scratch.
On this page scroll down and click 0.
Then click the square icon on top and highlight 20 squares by clicking and dragging and press CTRL+C. Make sure that you create this in between the leftside and the rightside.
Then click abcxyz to your left and select 1.
On this window, press CTRL+V to paste what you have copied and then minimize the number of square down to 12 by clicking and dragging the corners.
Then go back to abcxyz to your left and click 2.
Again, press CTRL+V to paste what you have copied and then minimize the number of square down to 4 by clicking and dragging the corners.
When we go back to abcxyz, we will see that we already have our healthbar created. Now let us click on the navigate button found in the upper left hand corner.
Select export font and then Export OTF Font.
Once it is done downloading, open the file and install it.
Now lets go ahead and open Buildbox and add the font that we have created.
Let us click the Menu Editor so we can go to Mind Map and open World UI.
Once inside the World UI, Click the font on the upper left hand side, search for the Health Bar font in the fonts panel, then click add. After this you will have an option to rename the font to Health Bar. Once done lets click the X button to close it.
On the World UI, lets drag the Health Bar label to the upper right and make it a little bigger, then selected the options below:
Function [Score]
World [All]
Score Type [Points]
Amount [Current]
Alignment [Left]
Font [Health Bar]
Stick To Edge [Checked]
Now let us add an Event Observer, change its name to Health Bar, change Event Type to Total Points and Session Total to 3.
Let us then go back to the Mind Map and link the Event Observer that we have created to the Game Over UI.
Going back to the Game World (blue node), I am going to bring an image as an action which will serve as points for the health bar. Does not matter what image we use.
Once done, let us select the Action that we just dragged in so we can edit its settings.
On the options panel to the right, change the name of of the Action and select the settings shown below.
Then let us edit a few options for our Character. Click on the Character on the assets panel found on the left side of Buildbox.
At the lower right hand corner of the options panel, click Add Component and select Damage, after that do the same thing, this time select Health.
Leave the Damage fields as it is, but change the Health to 999.
Now click the Action image that we dragged in earlier and press CTRL X.
Click the enemy on the assets panel to edit its settings.
Click the pen icon in the Defeated Animation section of the enemy.
Press CTRL C, to paste the copied image (you may need to use your mouse scroll to find the pasted item). And change the opacity to 0.
And this is what it looks like when you preview your game.