How do I change animation's frame speed with code

Get help using Construct 2

Post » Fri Nov 13, 2015 8:35 pm

So I want to change speed of specific frame with the code... so I won't have to create 100 animations with same sprites, but will have just one, which will be controled with the code...

Anyone? :)
B
6
Posts: 18
Reputation: 289

Post » Sat Nov 14, 2015 12:32 am

Would making another animation that's just the frame you want to change the speed of work? You could then switch to that and change the speed of that particular animation and then switch back to original.

Scratch that, you can probably just use compare frame condition to check for when you want to slow or speed up the animation.
B
17
S
6
G
1
Posts: 41
Reputation: 1,725

Post » Sat Nov 14, 2015 1:18 am

The problem is I don't want to change speed of all animation. Just specific frame. Other frame must be independent.

Oh... I didn't understant at first time. Well, maybe having every sprite as different animation will work. I can set playing one after another stops, then control the speed of them separetly. Yes, I think it'll work :) Thanks for clearing my mind :)
B
6
Posts: 18
Reputation: 289

Post » Sat Nov 14, 2015 5:34 am

If I understand what you are asking, you can change the speed of a specific frame in the image editor using the animation frame properties.
Just double-click the sprite, click on the frame of the animation you want to change and in the properties there will be a Frame Speed you can edit.
As far as I know, you cannot edit the frame speed using events though.
Be sure to check out my Metroidvania game, A Hole in the Earth
B
59
S
24
G
3
Posts: 359
Reputation: 5,683

Post » Sat Nov 14, 2015 10:24 am

What I meant with compare frame was that you could skip doing multiple animations by checking for the frame at which you want to change speed and changing it back to normal at a later frame.
And wow, there is indeed frame speed for each frame. :o
B
17
S
6
G
1
Posts: 41
Reputation: 1,725

Post » Sat Nov 14, 2015 10:33 am

Yes, yes. I wanted to change frame speed with events, I know I can change I from animation properties :)

I will just have every frame as separate animation. That will do 😊
B
6
Posts: 18
Reputation: 289

Post » Sun Jan 31, 2016 4:59 pm

AnimationFrameSpeed is a sorely needed sprite expression. Without it there is no way to time animations which have frames with a speed of more than 1. Replicating frames for a large number of animations is not an acceptable workaround.

Would appreciate a response from the @Scirra team on this.
B
4
S
1
Posts: 7
Reputation: 314

Post » Sun Jan 31, 2016 6:58 pm

I know Aesprite can export .json file for animations. I wonder if there would be a way to load animation info ingame.
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Fri Apr 28, 2017 11:36 pm

shakeerakuan wrote:AnimationFrameSpeed is a sorely needed sprite expression. Without it there is no way to time animations which have frames with a speed of more than 1. Replicating frames for a large number of animations is not an acceptable workaround.

Would appreciate a response from the @Scirra team on this.


There's a lot of stuff missing from the expressions/actions. I'd rather not create a behavior just to get/set the frame speed, but it looks like I'm going to have to. :\
B
43
S
19
G
65
Posts: 1,098
Reputation: 37,933


Return to How do I....?

Who is online

Users browsing this forum: David181, nahima, Shenkai the ssj and 23 guests