Animate multiple enemies with separate collision..

Get help using Construct 2

Post » Mon Sep 03, 2012 6:13 pm

So, I have a spawnpoint, each one spawns an enemy collision, then a sprite which it pins to the collision.

I want to change the animation of each sprite when its associated collision is moving (8 direction). I've got the movement working fine, they move as individual enemies but yet the problem is that they will ONLY change the animation when ALL instances of the collision are moving, and ALL instances change their animation, not just the ones that are actually moving.

What I want to do is have a sprite animate ONLY if the collision it's pinned to is moving.

I've tried assigning an ID instance variable and checking the sprite's ID matches the collision ID and it still works the same way.

Any help would be massively appreciated as this project WAS going so well until now! Thanks!
B
14
S
2
G
6
Posts: 52
Reputation: 3,633

Post » Mon Sep 03, 2012 8:26 pm

I think this read can help you: http://www.scirra.com/tutorials/361/understanding-uid-iid-health-of-enemies-and-rocket-smoke-trail

Plus, you have to deal with instance variables. Make one instance variable for each individual object you want move separated.

By checking their ID, only the designated ID will go ahead with the code, and if more than one have their conditional meet, they will have separated instances working in parallel.

I can't think in other phrase than "encapsulating the event" for this type of solution ^^

Feel free to ask more, or share your CAPX and we can make the deal for you.
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,212
Reputation: 18,482

Post » Sat Sep 08, 2012 12:25 pm

Oddly enough this worked, while I was doing something very close to this which should've also worked in theory.

Anyway, nevermind it's working now - thanks for the help! :D
B
14
S
2
G
6
Posts: 52
Reputation: 3,633


Return to How do I....?

Who is online

Users browsing this forum: makkancs and 25 guests