How do I Set individual health variable in a family?

Get help using Construct 2

Post » Tue Jan 19, 2016 8:23 pm


I'm having a bit of trouble with this one. I have Enemy 1, 2, and 3. Their health is to be 10, 20 and 30 respectively. I placed them in a family called "Enemies". I've been trying for a bit to make it so when a bullet collides with the "enemies" family, it reduces that instances health by one. But I can't just set a health variable through the family for all of them because each type of enemy has different health totals, and I can't subtract one from three family health variables (health1, health2, heath3) because that kills all enemy 1's if enemy 2 is shot ten times. So how do I subtract from unique health variables upon a family collision condition?


Posts: 25
Reputation: 356

Post » Tue Jan 19, 2016 9:54 pm

"Health" has to be a family instance variable. Next, the simplest method would be to add "On created" trigger for each of your enemy.

Enemy 1 -> On created -> Set Enemy 1 "Health" variable to 10
Enemy 2 -> On created -> Set Enemy 2 "Health" variable to 20

The collision event will now have to look like this :
Enemies -> On collision with bullet -> Subtract 1 from "Health"
Posts: 1,029
Reputation: 21,143

Return to How do I....?

Who is online

Users browsing this forum: dioking, kelany and 0 guests