Iterating through animation

Discussion and feedback on Construct 2

Post » Wed Nov 14, 2012 10:33 am

Is it possible for C2 to implement some sort of animation iterator?
B
7
S
1
Posts: 38
Reputation: 833

Post » Wed Nov 14, 2012 10:50 am

Do you need to iterate through different animations, or do you need to iterate through different frames to achieve a single animation?

If the latter, the sprite object already has that functionality with a number of options available -- take a look in the animation editor -- and perhaps the accompanying manual entry. If the former, could you be more specific about what you're actually trying to achieve?
B
32
S
8
G
2
Posts: 110
Reputation: 3,648

Post » Wed Nov 14, 2012 11:52 am

Iterate through different animations of course.
B
7
S
1
Posts: 38
Reputation: 833

Post » Thu Nov 15, 2012 5:08 am

Alright, why do you want to iterate through different animations, and do you just need to repeat through them in order or do you need some variation in the order?

Is there a reason you can't combine the frames from each individual animation into a single larger animation?

If that's not suitable you could probably implement some logic using the "On any finished" condition and the "Set animation" action of the sprite plugin. Off the top of my head I might try implementing a queue of animation names using the array plug-in; pop the next animation name from the front of the queue and push the previous one on to the back of the array each time the condition is triggered.

Does that help at all?
B
32
S
8
G
2
Posts: 110
Reputation: 3,648

Post » Thu Nov 15, 2012 7:42 am

I'm trying to find out how many animations does a sprite have. Based on the count, it will exhibit different behavior.
B
7
S
1
Posts: 38
Reputation: 833

Post » Thu Nov 15, 2012 10:52 am

You could add an instance variable with the count of animations. You would have to manually update it... but then you have to manually add the animations anyway, so it's only a small amount of work.
B
32
S
8
G
2
Posts: 110
Reputation: 3,648

Post » Fri Nov 16, 2012 5:18 am

The thing is I would like to dynamically check within a family of objects based on the number of animations they have, the behaviours would be different. And I am not working alone for my project which is why when people start adding more stuff into the family, some behaviours might break. That is why I would like some sort of animation iterator.
B
7
S
1
Posts: 38
Reputation: 833

Post » Fri Nov 16, 2012 5:20 am

And it would be best if I could get the animation names as well from the iterator.
B
7
S
1
Posts: 38
Reputation: 833


Return to Construct 2 General

Who is online

Users browsing this forum: SirG and 17 guests