Add to health variable

0 favourites
  • 3 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)