[SOLVED] How do I pick one object from family by variable

Get help using Construct 2

Post » Sat Jan 02, 2016 8:33 am

How do I pick one object from family by family variable and change only that one's object animation frame?
Here is a screen of my code^
Image
So there are several enemies on screen in enemy family. Player attacks them and their hp goes down. That is simple.
I want to check if an enemy lost half hp, then change his animation frame. Method on screen works fine for selecting specific enemy, not family.
I've put trigger once but it affets only one enemy, and until he is destroyed other's frame won't change even if hp met condition.
If i put trigger once away - then all family members on screen will change animation even if only one of them really met condition.
Last edited by NoSoul8 on Sat Jan 02, 2016 1:21 pm, edited 1 time in total.
B
12
S
1
Posts: 24
Reputation: 611

Post » Sat Jan 02, 2016 10:50 am

Works without a problem for me. Check if only the hp of the one family member that is attacked is subtracted and not all.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Sat Jan 02, 2016 10:58 am

Asmodean wrote:Works without a problem for me. Check if only the hp of the one family member that is attacked is subtracted and not all.

Double checked that, only attacked one family member has his en_hp reduced.
B
12
S
1
Posts: 24
Reputation: 611

Post » Sat Jan 02, 2016 11:16 am

It's hard to say more without knowing your capx. Maybe you set the animation frame in another event too but I can only guess.
This is my example and you could see that it worked without problem. You have to hit the squares 5 times then it will change the colour.
https://drive.google.com/file/d/0B5FlDY ... sp=sharing
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Sat Jan 02, 2016 1:20 pm

Maybe i went the hard way, but code from screen below works like magic. I added check for objects that already were affected.
Image
Special thanks to Asmodean for pointing me to right direction )
B
12
S
1
Posts: 24
Reputation: 611


Return to How do I....?

Who is online

Users browsing this forum: JDebstup, Leef and 19 guests