Static Family instance variables?

Get help using Construct 2

Post » Tue Oct 18, 2016 6:26 am

Hi all. Can someone please help me in figuring this out?

Okay, so I have an enemy family, the family has a family instance variable of "HP" and I've set it to 100.

I have a bunch of enemies in one layout and when damaged the HP value changes individually for each one, perfect so far.

If I leave the layout however, and then come back to it later their health values reset to 100. I don't want that, I want the damage each of them took to persist between layouts...but family instance variables aren't static, and it doesn't seem that they can be set to be static either. I mean, I think I understand why they can't be static but I'm not sure what else to try now.

Global variables don't make a whole lot of sense for multiple enemies of the same type, right? And local variables have always confused me a bit to be honest and I'm not sure how to implement something like that anyway.

Any solution to this problem? Thanks for any help.
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Tue Oct 18, 2016 6:43 am

Hi

Put the Persist behavior on your enemy family.
B
18
S
7
G
1
Posts: 56
Reputation: 3,000

Post » Tue Oct 18, 2016 7:00 am

Haha can't believe it was that simple.

Thanks a lot! :)
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Wed Oct 19, 2016 4:59 pm

You are welcome^^
B
18
S
7
G
1
Posts: 56
Reputation: 3,000


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests