How do I Subtract from individual variable from a family.

Get help using Construct 2

Post » Thu Jan 14, 2016 4:43 pm

Hi,

I'm making a game where I've created a family called "enemies", and have it set up so whenever the bullet hits the enemy they lose health. However, my enemies are supposed to have different amounts of health. How do I say subtract health from "enemies", but have it affect different instance variables?

Thanks,

William
B
8
Posts: 25
Reputation: 356

Post » Thu Jan 14, 2016 4:50 pm

Hi @WilliamAnderson, if I understood, the collision trigger already pick bouth instances (bullet and enemy), you just need to put Enemies (familly) health subtract 1 as a action of the trigger (condition). It´ll take out 1 from the enemy that collided with the bullet.

The variable health must be in the family, not the instance.
B
18
S
4
G
1
Posts: 143
Reputation: 1,868

Post » Thu Jan 14, 2016 5:11 pm

But what if enemies have two different health totals? I cannot have one family health variable representing both.

Thanks,

WIlliam
B
8
Posts: 25
Reputation: 356

Post » Thu Jan 14, 2016 5:19 pm

You have a family of enemies.
You can set any variable that you want in it.
healthAB
healthCD

When collide, you say wich variable you´ll subtract.
B
18
S
4
G
1
Posts: 143
Reputation: 1,868


Return to How do I....?

Who is online

Users browsing this forum: GunnarWomack, kiugetski and 13 guests