How do I make Monster HP bigger each time it dies?

Get help using Construct 2

Post » Thu Jul 14, 2016 5:26 pm

Hi. I am currently learning to use Construct 2 and making a simple shooter by myself. There are 4 levels with a monster in each level.
Players could choose which monster they would like to fight on the level selection screen. Each time you defeat the monster, it will send you back to the level selection screen. I wanted to make a monster whose HP gets larger each time it dies.

Here is the scenario. Base of a monster's HP is 100. Each time it dies it increases its HP by 2 times the current amount. This new HP will be used when the player fights the monster again.

Lets say that if it has already been defeated 3 times, its current HP on the 4th battle would be (((100 X 2) X 2) X 2) = 800 HP

However, I keep getting stuck after each monster battle as it stops increasing its HP at 200 HP. Is there anyone who could help me with this?
B
3
Posts: 2
Reputation: 179

Post » Thu Jul 14, 2016 5:38 pm

Assuming you have a maxhp or monsterlevel GLOBAL variable for each monster (you don't want an instance variable, because that gets lost when the instance is destroyed). It starts at 0.

Trigger Monster on Death - Increase monsterlevel by one
On monster created - Set hp to 100*(2^monsterlevel)

Or

Trigger Monster on Death - Set maxhp to maxhp*2
On monster created - Set hp to maxhp
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Thu Jul 14, 2016 6:09 pm

Thank you very much oosyrag! I can now get a progress on my game.
B
3
Posts: 2
Reputation: 179


Return to How do I....?

Who is online

Users browsing this forum: plinkie and 19 guests