Is there a way to count number of animations for a sprite?

Get help using Construct 2

Post » Wed Mar 23, 2016 5:37 pm

I know there is a AnimationFrameCount to count the number of frames in an animation but I didn't see anything like AnimationCount to count the number of different animations in a Sprite. Is there any other way to detect this? Or the amount of animations in a animation sub-folder?
ImageImageImage
B
40
S
23
G
11
Posts: 498
Reputation: 10,062

Post » Wed Mar 23, 2016 5:50 pm

I guess you would have to count it manually. I can't really think of a use for being able to know the number of animations when your game is running.
B
92
S
32
G
109
Posts: 5,290
Reputation: 70,991

Post » Wed Mar 23, 2016 6:24 pm

I was actually trying to help someone else answer a question for choosing a random animation. If there was a count expression you could simply do Play Animation: "Animation"&ceil(random(0, AnimationCount)) and name them Animation1, Animation2, etc.

Yes, it is not that useful, as opposed to just counting yourself, but I always appreciate it when setup to avoid manual input and oversight, when adding/removing animations in this case.

More specifically was thinking Idle animations so add a folder for all the Idle animations and name them Idle1, Idle2, etc and find a way to do a count for the animations in that folder
ImageImageImage
B
40
S
23
G
11
Posts: 498
Reputation: 10,062


Return to How do I....?

Who is online

Users browsing this forum: ditocruz, RalleRoyal and 33 guests