How do I make two different healths for a single monster

Get help using Construct 2

Post » Thu Jun 11, 2015 11:52 am

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
Posts: 1
Reputation: 152

Post » Thu Jun 11, 2015 12:17 pm

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.
Posts: 280
Reputation: 2,522

Post » Thu Jun 11, 2015 12:19 pm

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...)
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Posts: 7,357
Reputation: 73,458

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider] and 9 guests