In this tutorial I will be continuing on about leveling up and this one will be more specific pertaining to RPG styled leveling. We will be killing enemies to get experience, and then level up and increase max health.
-
We'll start over rather than continue from my my last tutorial.
-
To Start
-
I always start my tutorials by teaching how to test the theory. If you want to skip it jump down to Summary
-
Let's get right into it. Start a new top-down shooter template. Then add 2 number global variables, one XP and one LVL. LVL should initially be 1. then you want to add [Add 10 to XP] to the [Enemy health < 0 destroy] event. and then add an event at the bottom[ XP greater or equal to 25 > set LVL 2] Here's the picture so you can make sure you're up to speed. I deleted all the notes from the template if it looks different to you.
-
-
Not Bad...
-
So we have so you can level up to level 2. Big deal, we covered that in the last tutorial, let's learn some more. Let's Add health and make sure we can test that the health works very fast. Add 2 global variables, one Health, and one MaxHealth. They both should initially be 100. Now lets add it so on player collision with enemy you lose a chunk of that health. [Player> On Collision with Enemy > subtract 10 from health] So far it should look like this.
-
-
Now Let's Learn
-
Just to simplify things we'll change the text that's already in the project to 100. And then add another action to player on collision with enemy [set Text to Health] Now we have a visible health to test the health gaining on level up. Make a little sprite about 10x10 and name it Healthpickup. Make a new event [Player on collision with healthpickup > Destroy Health Pickup +> Add 25 to health +> set text to health] Go ahead and scatter a bunch of them on the layout. Now we need to add an event to make the max health work as an end parameter. [System>CompareVariable>Health is greater than MaxHealth> System>set variable> Health to MaxHealth] and another condition to the same event [Set text to Health] Now add another condition to [Xp greater or equal to 25 > set lvl to 2] +> Set Max Health to 125. You can copy this event and make a lvl 3. Make sure it looks like this.
-
-
If you want to add more things that leveling up contributes to, i would recommend breaking the exp and the level up coding to make it more like this.
-
-
Summary
-
So we learned how to make a end parameter for your health that increases with each level. I will be adding a second part to this tutorial including how to set up weapons with level requirements and maybe more. Note that I didn't include adding setting health to max health on level up. You can do this by adding a [trigger once while true] condition to each level up event. and then add the condition [Set health to maxhealth] to each level up event as well, under set maxhealth to #. Follow up tutorial shortly.
-
-
Thank You for following along.