Then, we want to destroy the boss and, possibly, do something else as well.
This is because we want to test whether the boss’s health contains anything less than 1 which would be either 0 or a negative value like -1 just in case something unexpected happens during the game causing the boss’s health to go below 0. Choose “less than” in the drop down box labeled “operation”. So in that step event, place the test variable action (shown below), type “bosshealth” for the variable name, and type “1” for the value. This action tests whether the number inside a variable is higher than another number, lower than another number, or exactly equal to another number. Go to objBoss’s step event here, we’re going to use a new action, called “test variable”. We have to check if health is gone and if so kill the boss. Note from here on out, I’m going to call the boss object “objBoss”. We should test whether the boss is dead all the time, so we’re going to do this in the boss’s step event of your boss. Now, we want the boss to die when it runs out of health. For example, if a bullet hits the boss, deduct from the boss’s hp, and then destroy the bullet object. Make sure that if the event does not belong to the boss, then you set the “applies to” field to either other (for other objects’ collision events) or object (for some other event make sure you select the boss object).Īs a side note, if a specific object damages the boss, make sure you destroy it after it touches the boss so the boss doesn’t get hit continuously.
So if bosshealth already has 10 inside it, and you add -1, you get 9 (one less than ten, which is exactly what you want). Checking the relative box tells GM to add the number you typed to whatever is already inside the variable. Type in “bosshealth” for the name, but this time, put -1 for the value and check the “relative” box. Go to that event, whatever it may be, and in it once again place the “set variable” action. So in the event where your boss “gets hit” (perhaps in a collision event with the player’s bullet object? when the player jumps on top of the boss? when the boss runs into a wall? etc.), we should subtract 1 from bosshealth. Of course, we want the hp to drop every time the boss is hit. Note, that because the boss object made this variable, it will normally only work inside the boss object. Call the variable “bosshealth” and give it a value of 10. We want to use a variable to give the boss some health, so place this action in the create event of your boss. Inside this action, you specify the variable’s name and the number it should hold (the “value”). To make a variable, you use this action, called “set variable”:
#GAME MAKER STUDIO PRO CANNOT LOG IN CODE#
To understand variables, you can read SoulHow to code in GML if you want, but all you really need to know at this point is that variables are like containers that you put numbers into. To do this, we need to use what’s called a variable. No boss is any good unless you have to hit it a bunch of times before it dies.
#GAME MAKER STUDIO PRO CANNOT LOG IN HOW TO#
All bosses are different, so instead of giving you an example for a complete boss, I will give you an example of how to make each part of a boss, from health, to health bars, to attacks. So how exactly do you make a boss? Honestly, the answer is, there is no answer. In fact, I’ll show you how to do it with actions! If you’re a code-person, fear not, because, it shouldn’t be too difficult to convert the actions to GML code. You’re in luck, because that’s what I will explain in this SoulHow guide. I have written an article about ways to improve your currently made bosses, but I seem to have omitted an article about how to actually create a boss in Game Maker. I no longer answer questions about the Game Maker tutorials on this blog I suggest you take any questions to the Game Maker Community.