How do I make two different healths for a single monster

  • i have made a global variable

    health of monster medium level=2

    and made an event and action

    bullet on collision with monster>health of monster medium-1

    health of monster medium_<0s monster destroy

    but it is working for all of my same monsters

    i want to make different healths in different levels

    pls reply ASAP

  • Several ways to do it.

    You could use two variables, a variable for the monster HP and one variable to keep track what level your player is. And then you set the value of the monster HP related to the number of the variable keeping track of the level.

    Or, you create a bunch of different variables with the HP of different monster.

    Or, you create a instance variable inside your Monster object and then you set the value of this variable to the amount of HP you want your monster to have.

    Each way applies better depending on what exactly you want to do.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You probably should use instance variable that are tied to the instance of the monster itself (as explained in the beginner's guide page 6).

    From there, you can keep your global variable as a reference of the starting health. So on start of layout, you set the "Health" instance variable of your monsters to the value of the global variable modified according to the layout/level you are currently in (you may add 1 when in level 1, 2 when in level 2, etc...)

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