Want to check out a PDF of this tutorial? Right click save as HERE.
Last time we created a boss and gave it three hit points. Now we’re going to cover how to display those hit points on the screen with numbers. Open up your file from the last tutorial and we’ll get started! Also take this transparent resource real quick for use later.
The first thing we need to do is to create a switch. Head to the “Materials” tab and the “Switches” sub-tab and hit “Create”. This switch is going to be used to turn on and off the health display so name it “Boss HP” and leave its initial value off.
Next head to the “Menus” tab and the “Items” sub-tab. Hit “Create” and we’ll make a new item called “Boss HP Display”. Just like with animations you’ll need to set a graphic for this, even though at the moment we’re only displaying text. So use the transparent graphic included with this tutorial (you’ll have to set it as a graphic under the “Material” tab and allow it to be used as an item first, but you should know how to do that already).
Head to the “Item-Specific Functions” sub-sub-tab and look underneath “Item Possession And Usage Settings”. In the drop-down menu for “Memory For Registering Quantity” find “Health Data Copy Destination”. Below that a bit you’ll see “Usage Conditions”. Check the box for “Switch On To Display” and select our Boss HP switch that we just made.
Note that you COULD have made that switch on this screen using the “Create” button next to the drop-down menu but I thought it’d be a good idea to get a bit more familiar with the “Materials” tab instead.
Now you need to create a menu and put our HP display on it so head to the “Menus” sub-tab and hit “Create”. Call this one “Boss Screen”. Switch over to the “Items” sub-sub-tab, select Boss HP Display, and put it somewhere on the screen. I put mine around the middle near the top.
You won’t actually see anything on the screen when you do this so it may take some trial and error to get this where you want it. Next use the arrow in the lower right corner to pull up the real menu for this screen. Head to the new “Items” tab, pick our item, and scroll the window down to the bottom. You’ll see “Graphics & Numerical Data Display Settings”. Pick one of the default fonts from the drop-down menu (I used Font 16×16) and check the box next to “Quantity”. Don’t bother with changing any numbers.
Now our new menu needs to be displayed on the proper screen. Head to the “Canvases” sub-tab, select the canvas you put your boss on last time, go to the “Per Canvas Settings” sub-sub-tab, and choose the new menu in the drop-down menu under “The Menu To Be Displayed On This Canvas”. Now that the health is ready to be displayed we just need to set it up so that the switch turns it on and it displays the right information.
Head to the “Gadgets” sub-tab. What we’re going to do is select the Boss gadget we created and create two new action programs for him. One will be called “Switch” and one will be called “Health”. They can both use the boss’ walking right animation. Use the small + button next to the words “Action Programs” to create new action programs. I moved Switch and Health up to the top of the list so that it would be easier for me to visualize the order that the boss’ action programs change.
Once you have the animations set up for the two new action programs select our Switch action program. Under “The Selected Motion Program’s Settings” hit the switch for “Don’t Designate A Direction Of Movement” and drop the “Movement Speed” from 100 to 0. Scroll down a little bit to find the option to “Flick A Switch On/Off” and check the box. Find our Boss HP switch and select it to be turned on. Now select the Health action program and do the same thing for it but instead of the Boss HP switch we’re going to use “Copy Gadget’s Health”.
Now go to both of the Dying action programs and have them turn the Boss HP switch off. You should also remove the memory that makes the player jump from these two action programs as well because this can cause minor problems with the switch turning off and then turning back on immediately. Then head to the Invisible action program and have it turn off “Copy Gadget’s Health”.
Now you need to set it up so that our Switch action program is the first action program displayed. You can do this under the “Emergence Settings” sub-sub-tab in the drop-down menu for “The First Action Program”. You also have to set it up so that the action program Switch changes to Health and Health changes to Walking Right. Use the option to “Forcibly Branch Without Any Time Lapse” for these so that it is instantaneous.
Test your game out, head to your boss and check out the number 3 on his screen. Then bounce on his head to watch it go down to 0 and it’ll disappear when he does. That’s it! You’ve just learned how to display numbers, how to make switches that control when they appear, and how to use the “Copy Gadget’s Health” switch to display a particular enemy’s health.
The options you have from this point are pretty limitless. Have it so that every enemy you attack activates this switch and you can have every enemy in your game display their health while you’re fighting them! It is a powerful switch once you learn how to use it. You can also use regular “Memories” to display things like ammo counts, the number of a particular item you’re carrying, levels, experience points, stats, etc.
There are a ton of things you can do with “Memories” and using switches to display them gives you a lot of control over how you use them in your game.
Special Note: Make sure that you don’t use “Copy Gadget’s Health” on the first “Action Program”. For some reason it does not copy properly on the first, but it will work on the second and any beyond that. You can use dummy actions that “Forcibly Branch Without Any Time Lapse” to get around this easily without affecting your gameplay at all.
In the next tutorial we’ll switch things up a bit and start working with things in a 2D Shooter!
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.