How do I give each instance its own animation?

Get help using Construct 2

Post » Tue Nov 22, 2016 12:33 pm

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
B
4
S
1
Posts: 2
Reputation: 254

Post » Tue Nov 22, 2016 1:34 pm

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'.
B
46
S
16
G
79
Posts: 2,170
Reputation: 46,857

Post » Tue Nov 22, 2016 1:54 pm

plinkie wrote: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
B
4
S
1
Posts: 2
Reputation: 254

Post » Tue Nov 22, 2016 2:16 pm

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.
B
46
S
16
G
79
Posts: 2,170
Reputation: 46,857


Return to How do I....?

Who is online

Users browsing this forum: ratboy3 and 44 guests