Add to health variable

Get help using Construct 2

Post » Mon Feb 24, 2014 7:31 pm

Hi guys and gals,

I'm working on a tower defense game and I want to increase the health instance variable on the enemy every wave, however when i do;

system compare wave=2 - enemy add 50 to health.

Instead of doing this once it does it every tick which makes my enemies pretty near indestructible ;)

Any advice greatly appreciated.
B
2
Posts: 9
Reputation: 193

Post » Mon Feb 24, 2014 8:24 pm

well your "Code" says:

as long as wave = 2 --> add 50 to health

and the system works every tick!
add a 2nd. var to your minions namend Level as Number = 1

system compare wave = 2
minoin.level is < 2 --> minion.health +50
minion.level set 2
B
18
S
6
G
3
Posts: 197
Reputation: 4,129

Post » Mon Feb 24, 2014 8:59 pm

You could add a "Once While True". But designing any even system like that wher eyou need to duplicate the same event for increment is not a good idea. Instead re-think how your going about it.

Think about how your end condition occurs. At your end condition call a Function called say "wave.start" with param a param equal to wave_current + 1

so
global or sheet group variable called
wave_current = 1

End Wave condition met(what ever that is)
Function.call("wave.start", wave_current + 1)


On Function wave.start
set Enemies to X
set wave_current = Function.Param(0) //<- notice how your updating wave_current
enemies health = current_wave * 50

following this line of design. then there is not check for your wave. Instead the health of the enemies are effected naturally as your waves increase rather than make wave exception codes. Which could cause design problems
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013


Return to How do I....?

Who is online

Users browsing this forum: plinkie and 3 guests