How do I give each instance its own animation?

0 favourites
  • 4 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Hello guys,

    I hope this question hasn't been asked before, if so, please accept my apology, I did try searching the forums and tutorials for a bit, but I did not manage to find an anserw.

    I am having an issue with multipleinstances of the same object.

    For each character, I have two objects. Squarish hitbox and animation. I've watched few tutorials and this is apparently the best way to handle collisions, when your object isn't a square, if I am wrong, please feel free to correct me. At the moment, I am trying to figure out how to make sure that the animation instance belongs to only one hitbox.

    Right now, the instance that is spawned first (at the images below, it's the bug at the bottom) directs both the animation instances.

    At first everything is going fine.

    https://drive.google.com/open?id=0B0gDew4UUmpASFZHaEJDN09xM1E

    But as soon, as the bottom bug changes direction, both animation instances follow him.

    https://drive.google.com/open?id=0B0gDew4UUmpAZE1mclByaGJONHM

    This is how I handle pinning the animation to the hitbox.

    https://drive.google.com/open?id=0B0gDew4UUmpAQVVNUW9id0p4U28

    Any advices how to fix this issue or handle the animation system better?

    Thank you very much

  • Your event will pin everything to the one instance because you haven't 'picked' anything so it defaults to picking the first instance. Your logic should be something like 'for each worker - spawn animation, pin to worker', essentially putting those last two actions into a 'for each'.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your event will pin everything to the one instance because you haven't 'picked' anything so it defaults to picking the first instance. Your logic should be something like 'for each worker - spawn animation, pin to worker', essentially putting those last two actions into a 'for each'.

    Thanks for a quick reply.

    I did try that and it does help with pinning the animation to its own worker. So if the top worker is killed, the animation stays where it was killed, instead of following the bottom one.

    However, what animation plays, is still dependant on the bottom worker.

    https://drive.google.com/open?id=0B0gDew4UUmpAYV91UW1CRGlBMXc

    It must be the related to the way I tell the game what animation should play. How do I connect the worker with its own animation, so that the state of each worker, effects only its own animation?

    https://drive.google.com/open?id=0B0gDew4UUmpARkZkN2lieGVwZzg

  • In the same way as picking for the pinning, you need to pick instances for animation change so you'll need a for each again to split everything out. When you say for each you are saying for each individual instance of the object. If you don't specify this you are saying please do it with the first instance of the object.

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