Set Animation Speed Of Any Animation

  • Is there a way to set the animation speed not of the current animation, but

    to some specific animation of a sprite?

  • 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.

  • 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.

  • 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

  • Yes, there is a set animation speed action.

    It's under Animations, then Set Speed.

  • ArcadEd: Thanks, but this i know 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 ), 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.

  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

    Thanks for all help and ideas.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)