solved How do I Level up monster every max score

Get help using Construct 2

Post » Fri Feb 13, 2015 8:02 pm

One question :

variable_maxscore = 5000

if maxscore >= 5000 -> enemy add to private variable hp 100 , exp 100 , dmg 100 add to maxscore previous value score

the problem is that this formula does not add private variables to monsters
the game is endless runner so enemy is created for every 2 or 3 or 4 seconds

basically its something like that

enemy -> on created -> score -> maxscore -> enemy add 100 hp , etc...

It doesn't work , i think that something is wrong with my logic
please help or just reply topic i just explain it better to you
Last edited by DanielZeszut on Sat Feb 14, 2015 9:47 pm, edited 1 time in total.
B
5
Posts: 10
Reputation: 251

Post » Fri Feb 13, 2015 10:04 pm

When an object is created, its instance variables are set to the default values. So if I follow correctly your code won't work, since you'll be only adding to the values of the existing monsters.

To solve the problem, add some globals called enemy_hp, enemy_exp, enemy_dmg etc and add to those. Then, when spawning an enemy, set it's instance variables to those globals.
B
92
S
30
G
24
Posts: 3,191
Reputation: 32,584


Return to How do I....?

Who is online

Users browsing this forum: BobOfAMillion, jhjconstruct and 8 guests