IGM Tutorial: Lives Left

in Tutorials

Want to check out a PDF of this tutorial? Right click save as HERE.

Thus far in our shooting game we’ve made enemies, we have hit points, and we can die endlessly. Let’s go over how to put a cap on dying, show the number of lives left on the screen, and rock a game over screen.

So the first thing we need to do is figure out how many lives we want. I say two (just to keep it a different number from our max health). Open up our shooting game and head to the “Materials” tab and the “Memories” sub-tab. Here you’ll find a bunch of preset memories in red. One of them is “Player Lives Left”. There is also one for “Player Max Lives” but you don’t need to worry about it for now. On “Player Lives Left” just increase the number to two and you’re done here.

Now head over to the “Text” sub-tab and create three new texts that say “GAME OVER”, “HEALTH”, and “LIVES”. Then head to the “Shooting” tab and the “Canvases” sub-tab. Create a new canvas called “Game Over”. Remember it’ll need tiles so set those as land or invisible or some other place holder under the “Per Canvas Settings” sub-sub-tab.

Then switch back over to the “Layout” sub-sub-tab and click the “Gadgets” tab under “Layout Parts”. One of those is called “Text” which is a lovely gadget you can use for placing text to display at all times on any canvas. Grab it and place it in the middle of the canvas.

A window will pop up that allows you to choose which text you want to display, and which font to use. You can also change size, position, and even have your text follow a course if you want it to move around. You can also change colors. I made mine red for dramatic effect. It is a little easier to move the positioning around after you place the text though, as now you’ll be able to see it up on the canvas.

I went with 246×250 and the 16×16 font. You should note that changing the size does not make the font larger or smaller, but instead changes how large the window containing the text is. If you set this too small your text will be hidden outside of the “Text” gadget. Too large doesn’t really hold a penalty though. For this the default of 160×160 works fine.

Next head to the “Gadgets” sub-tab. Here we need to set your ship up so that it loses a life everytime it dies. We don’t want to do this on the Explosion Action Program because of it interrupting something later, so what we have to do is create another invisible action program that comes AFTER the other invisible action program.

It’s easiest to just copy the one that’s there already, and change it’s memory function from Player Health to Player Lives Left, and have it reduce by one via the Add option and setting it to -1.00. Make the first Invisible go to the second Invisible (which I named Invisible Death for now) via “Forcibly Branch Without Any Time Lapse”. Invisible Death will already be set to respawn your ship after a second has passed.

That’s all for this screen. Now on to the “Menus” tab!

Go to the “Items” sub-tab and here we’re going to create things for the other texts we made earlier, and something to keep track of lives like we did with health. So hit “Create” three times and rename the new items to “HEALTH”, “LIVES”, and “Player Lives Left”. Set up the “Text Display (Effective Only When Placing Menu Parts) for HEALTH and LIVES and set the “Memory For Registering Quantity” for Player Lives Left to it’s respective memory. When you’re done here head over to the “Menus” sub-tab and we’ll arrange things.

Your goal here is to place the text for HEALTH and LIVES above their respective numbers. I put mine in the upper left corner. I can’t really guide you here so just play around with placements on the grid until you find a spot you’re comfortable with. Remember you can test play your game to see where things are and how you need to adjust them. It took me a few tries, but eventually I settled on the following for my placements.

Positioning
HEALTH = 16×16
LIVES = 176×16
Player Health = 16×48
Player Lives Left = 176×48

Don’t forget to set it so that the font you want is displayed for the “Text Display Settings” for text, and the “Graphics & Numerical Display Settings” for the numbers (also make sure to check the box for “Quantity” here too).

Head to the “Flow” tab. Here you want to set it up so that each stage goes to our new Game Over canvas IF Player Lives Left = 0. So connect the stages to game over first. Then click on “Level 01″ and scroll down until you find “The Designated Memory’s Value Changed” and set it up for “Player Lives Left”, “Equal (==)”, and 0.00. Do the same for “Level 02″. Then have the Game Over canvas connect to our Menu canvas with “The Set Time Elapsed” and set it for 2.00 seconds.

Now head back to the “Shooting” tab and to the “Animations” sub-tab. Here I want you to set up an animation to be invisible. One frame using the Invisible graphic. This is a great thing to have when making gadgets that you want to operate in the background. When you’re done with that head over to the “Gadgets” sub-tab.

What we need to do is create two new gadget that refill our number of lives when we die and reset the switches for selecting a stage. Otherwise we’ll just keep getting game over screens and that’s no fun. So create two new gadgets and assign them the Invisible animation. Name one of them “Player Lives Left – Reset” and the other “Stages – Reset”.

For Player Lives Left – Reset just set it so that the memory Player Lives Left resets to default, and make it so that this gadget is only active when close to a camera (this option is on the “Emergence Settings” sub-sub-tab). For Stages – Reset you’ll need to make two Action Programs. One for each stage.

Then for each stage you’ll want to “Flick A Switch On/Off” and turn off each of the Stage switches we created. Have the first Action Program “Forcibly Branch Without Any Time Lapse”. Again this one should only be activated when close to a camera. Now place both of these gadgets on our “Menu” canvas. Everytime you come back to the menu your lives will refill and your stages will be unselected as if you’ve started a new game.

Ready to start your own game in IGM? Purchase IGM at a 10% discount using the coupon code igmakerohyeah. Any questions, comments? Ask them in the comment section below.

0 comments… add one

Leave a Comment