Animation Speed Based on Velocity

PixelgunPixelgun Member Posts: 111
edited January 2012 in Working with GS (Mac)
I'm wondering if there is a way to base animation on an actor's velocity. So for instance, the actor accelerates from 100 to 1200 velocity and the frame rate changes from 4 to 12 frames per second in direct proportion with the velocity. The end result is that the actor is moving faster and actually looks like its moving faster (i.e. animation is playing faster). How might one achieve this?

Comments

  • CloudsClouds Member Posts: 1,599
    To do this you need to jettison the 'animation' behaviour and flip through your pictures using 'change image' or 'change attribute'.
    Using one of these allows you to control how, why and where your animation plays.
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Tynan is a god.
  • PixelgunPixelgun Member Posts: 111
    aha! That's very helpful. Thanks @Tynan!
  • Fabri DamazioFabri Damazio Member Posts: 97
    Pixelgun,

    If you have 12 frames to 1.100 velocity (1200-100), you need 1 frame for each +-100 of velocity.

    One option is:

    Using the change image you can set WHEN velocity = 200 change to frame 2
    WHEN velocity = 300 change to frame 3
    WHEN velocity = 400 change to frame 4

    If your object moves from 100 to 1200 in 1 second, he will have all the 12 frames in one second
    If your object moves from 100 to 1200 in 10 seconds, he still use the 12 frames but in 10 seconds.

    I think it will give you the effect that you wanna.
  • CloudsClouds Member Posts: 1,599
    @TouchTiltGames

    Lol. As far as I remember this particular god stole that technique off other people (sorry . . . . other gods) here on this forum.

    : )
  • PixelgunPixelgun Member Posts: 111
    @NeoGeekStudios Yeah that's kind of how I figured it after Tynan's tip. Thanks for spelling it out for me though!
  • CloudsClouds Member Posts: 1,599
    edited January 2012
    One further thought.

    If your actor moves across the screen you could base what image is to be displayed by (for example) the X position of that actor.

    Imagine we have a 12 frame walk cycle . . . . as you progress across the screen we use the X position to chose the frame.
    An attribute called FrameNumber could be added to by the X value and told to loop after 12 (%12).
    This would be much more realistic and would also factor in velocity.
  • Fabri DamazioFabri Damazio Member Posts: 97
    Yeah Tynan is right.
    For each type of actor you will need a different approach.
    Here you have two ways. I hope one fit for what you need.
  • PixelgunPixelgun Member Posts: 111
    I'm working on a platformer, there will be jumping and probably climbing/falling. So there will be Y movement. So probably the first approach is best, it could even be applied to jump animations.
Sign In or Register to comment.