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

0 favourites
  • 5 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • 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^

    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.

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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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

  • Maybe i went the hard way, but code from screen below works like magic. I added check for objects that already were affected.

    Special thanks to Asmodean for pointing me to right direction )

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)