Suggestions: Animations

Discussion and feedback on Construct 2

Post » Wed Jan 11, 2012 4:46 pm

There should be an expression to get the amount of animations in a sprite, y'know? Like 'FrameCount' there should be one for 'AnimationCount' also animations should have indexes, so I can retrieve an animation name by using an index number to my advantage.

These reasons are because I have like 100+ animations in my sprite, and during runtime I want to be able to loop 0 to AnimationCount. I'll make an example:

-Start of Frame
+For "getanimations" from 0 to Sprite.AnimationCount     
=Text.SetText "Text.Text & newline & Sprite.GetAnimationNameFromIndex(loopindex("getanimations"))"

also I have events that need to access certain animation names @ specified indexes during runtime.

Thanks!dcrew2012-01-11 16:48:10
B
17
S
4
G
5
Posts: 226
Reputation: 4,042

Post » Wed Jan 11, 2012 5:31 pm

In the absolute, your pseudo code wouldn't give you the expected result.

THe logic you're using there would make ALL the animations being set one after the other EACH TICK. (So each tick, set the sprite to an animation after the other to the end of the animations stack)
In the end, you would only see the fixed first frame of the first animation. I guess this is not what you want.

Also, you could use some workaround to use a number in the name of your animations.

Ex:
Run1
Run2
Run3 etc...

Meaning that you can set Sprite animation to "Run" & loopindex("getanimations").

But once again, you would have to spread the switching of animations through several ticks, not just in a for loop.


Something more like :
glob var animIndex
Animations name setted as indicated earlier

Sprite: On any animation finished
-> System: Add 1 to animIndex
-> Sprite: set animation to "Run" & animIndex
(opt) -> Sprite: play animation

This should do the trick and doesn't require new ACE.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Jan 11, 2012 5:47 pm

[QUOTE=Kyatric]Ex:
Run1
Run2
Run3 etc...

Meaning that you can set Sprite animation to "Run" & loopindex("getanimations").

But once again, you would have to spread the switching of animations through several ticks, not just in a for loop.


Something more like :
glob var animIndex
Animations name setted as indicated earlier

Sprite: On any animation finished
-> System: Add 1 to animIndex
-> Sprite: set animation to "Run" & animIndex
(opt) -> Sprite: play animation

This should do the trick and doesn't require new ACE.[/QUOTE]

I have this already.

You're clearly not understanding correctly, I WANT the animations to have proper names, not "a1" and "a2" etc what I have now. this I want so the user doesn't have to worry which animation is what etc in my game.

for example: an m4a1 animation I want to have the name "M4A1 Assault Rifle" not "a87".

I'm pretty sure it wouldn't be hard to add.
B
17
S
4
G
5
Posts: 226
Reputation: 4,042


Return to Construct 2 General

Who is online

Users browsing this forum: GhoulishGames and 12 guests