Skip to content

⬅️ Previous part: 9. Adding bombs ➡️ Next part: 11. Game over

10. More lives

With extra lives, player will not be penalized immediately with a game over when they hit the bomb instead of the shape. This will remove one life out of the available ones, which we're gonna set to 3.

This will also be a good opportunity to use extensions, so we don't need to create everything ourselves.


Did you know that extensions are also made with events? You can inspect how they are done by clicking on one in the Project Manager and inspecting the behaviors, that are composed of events to create the actions and conditions of the behavior.

Click on the "Project manager" icon that is located in the top left corner of the editor.

This will open a panel where the search bar is at the bottom - click the "Search for new extensions".

The extension we are after is called "life".

This introduces a behavior called "Health", which we can then manipulate in our game to manage the life of an object. Click "Install in project" to be able to use it.


Behaviors allow to add new features and logic to your objects. They are useful to create objects by assembling a few behaviors that you can then manipulate with events.

While we're at it, we're gonna add another useful extension - "Flash". When the Monster will get hit by a bomb and lose one life, we will make him blink for a short period of time to give the extra feedback to the player about what happened.

Install that as well.

Now when we have both extensions installed, they should be listed in the left panel, under "Functions/Behaviors".

Click on the "Level1" to go back to the scene editor, then in the right panel with the "Objects" double click on the "Monster" - it will open a popup.

Click on the "Behaviors" tab, which is were you can add these behaviors to the object...

...and then "Add a behavior to the object".

Our newly added, custom extension should be listed and available to use - click it.

We're going to have the "Damage cooldown" set to 0,8 seconds (time when the Monster get hit and is indestructible, so it won't get hit again immediately by a different bomb), "Health" to 3 (current number of lives), and "Maximum health" to 3 (so the Monster will have three lives total).

Click on the "Add behavior to the object" to have another one.

The second one will be "Flash".

The "Half period" means the time when the object is invisible, and we're going to set it to 0,1 seconds. Below that, you can see the "Health" behavior we entered previously. Click "Apply" to have them saved.

Now click on the "Level1 (Events)", and then "Collision" label to make sure it's the active one. In the top right menu, click the "Choose and add an event" icon, and then "For each object" in the dropdown.

This will allow us to have a specific condition "Repeat for each Obstacle object".

Choose "Obstacle", "Collision", "Monster". This way the bombs will collide with the Monster, and we will be able to subtract the current number of lives when this happens.

The action "Delete an object" will remove the "Obstacle". Whenever a bomb hits the Monster, it will be deleted from the game.

Another action is going to be used to have the Monster be damaged by the bomb. "Monster", "Damage the object", 1. This means every single time the bomb hits the Monster, he will lose one life.

From within "Other actions" we're going to add a different sound when that happens. "Audio", "Play a sound", "Choose a new audio file" to open the file explorer window.

Select killed.wav file and open it to add it to the project.

Make sure the name of the file is there.

While the events work, they are only changing the life of the monster in memory. Let's display a life counter on the screen!

Click the "Level1" tab, and "Add a new object".

Make it another "Sprite".

Object's name is "Life", "Animation" is "Life3" (since the initial state of the animation have three lives), and then add the image of the hearts.

Repeat for "Life2"...

...and then "Life1".

Last one is "Life0" for when all the lives are lost. Apply the changes.

Drag and drop the "Life" object onto the scene and place it in the top right corner. We'll see during next chapter how to animate this "Life" object, making a "game over" screen when it reaches zero.

⬅️ Previous part: 9. Adding bombs ➡️ Next part: 11. Game over