Set Animation Speed Of Any Animation

Discussion and feedback on Construct 2

Post » Thu Mar 12, 2015 10:36 pm

Is there a way to set the animation speed not of the current animation, but
to some specific animation of a sprite?
B
11
S
2
Posts: 213
Reputation: 1,266

Post » Fri Mar 13, 2015 12:48 am

Every time you click on a animation in the image editor in Construct 2, you'll see a bar menu on the left that has information like
"Does this animation loop?"
"If this does not loop, how many times does it repeat? 0 = none"
"Animation speed in frames per second"

Read the entire manual carefully and you shouldn't run into any basic problems like this.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Fri Mar 13, 2015 1:43 am

If you click on an individual sprite in an animation there is a property called Frame Speed, this will allow you adjust the speed for each frame of an animation. If that is what you are asking.
B
101
S
32
G
11
Posts: 1,552
Reputation: 21,667

Post » Fri Mar 13, 2015 2:12 am

@Nesteris: I did not ask about this basic stuff, maybe i wasn't clear enough, but i thought it is clear when i said NOT the current animation. I want to change the animation speed at runtime! For example, if i have a boolean 'highspeed' and it's true i want the animation with 6fps, when false with 4fps
B
11
S
2
Posts: 213
Reputation: 1,266

Post » Fri Mar 13, 2015 2:48 am

Yes, there is a set animation speed action.

It's under Animations, then Set Speed.
B
101
S
32
G
11
Posts: 1,552
Reputation: 21,667

Post » Fri Mar 13, 2015 3:08 am

ArcadEd: Thanks, but this i know 8-) Like i said, i don't want change the speed of the current animation but of another animation my sprite has.

I make a platformer and want when my character loses too much energy, that his idle animation plays more fast than normally. My character sprite has 3 different animations: idle, run and jump. If the player releases the keys i switch to the idle state (so, current animation is idle now). The problem is, if i set the animation speed here, it doesn't always work. Because of this, i want to change the speed of idle already more early, when the player sprite still is in jump or run state and gets hurt/loses energy.

I had one idea now (in the shower :D ), but still did not test it:
maybe i can save the current animation name in a string, change animation to idle, set speed and change back to the animation i saved in the string variable. This could work, but i wish there would be a field to access all animations of a sprite easily.
B
11
S
2
Posts: 213
Reputation: 1,266

Post » Fri Mar 13, 2015 3:25 am

Chupup Games wrote:@Nesteris: I did not ask about this basic stuff, maybe i wasn't clear enough, but i thought it is clear when i said NOT the current animation. I want to change the animation speed at runtime! For example, if i have a boolean 'highspeed' and it's true i want the animation with 6fps, when false with 4fps



Be more specific next time then, because you never mentioned anything about run-time in the first post.

You could always make a duplicate animation, one with 6FPS and one with 4FPS. Or use time-scale changes if you're using the sprites just for graphical elements and an invisible sprite for collisions.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Fri Mar 13, 2015 3:34 am

Hey Chupup,

I'm surprised that setting the animation speed and animation in the same action block doesn't always work:
-- Set Animation "Idle"
-- Set Animation Speed X Value

Do you mean it doesn't work the first time through the animation (assuming looping), or it doesn't set the speed at all?

Your idea about changing animations, setting the speed and then restoring the original animation might work, but I think you'll also have to save off the original frame of animation so you can restore the correct frame as well.

Unfortunately, I have a feeling that when you restore the original animation, Construct will reset the amount of time that has elapsed for that specific animation frame. I'm referring to the speed of an individual frame of animation which is settable in the Animation Editor.
B
31
S
7
G
8
Posts: 232
Reputation: 6,254

Post » Fri Mar 13, 2015 3:47 am

cacotigon: i must see this tomorrow, it's too late now ^^
The problem is a bit more complicated than i wrote before, because the energy bar of the player
fills up again slowly with time and his idle animation must also change then if the player doesn't use
the keys. I will try again later to set all in the action block, maybe i made some mistake.

I think i don't need to restore the frame too, because my animations are so short that the player barely can see it
if the animation starts with another frame.
B
11
S
2
Posts: 213
Reputation: 1,266

Post » Fri Mar 13, 2015 3:24 pm

@cacotigon: ok, i see my problem now. It was because sometimes the state of the game character changes but the player doesn't use the keyboard, so putting the speed change in the key release condition alone is bullshit. Since C2 doesn't have a no user input condition i made one my own, where the game loop counts down after each key press and if it reaches 0 (no key was pressed in a given amount of time) then it sets the animation to idle and handles the speed, too. Everything works now as i wanted. :D

Thanks for all help and ideas.
B
11
S
2
Posts: 213
Reputation: 1,266


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 0 guests