Animation Controller DEMO

firemaplegamesfiremaplegames Member Posts: 3,211
edited November -1 in Working with GS (Mac)
Hey All,

Here is a quick demo showing how to use a Timer to control animations:

http://gamesalad.com/game/play/77625

This is in response to this thread:
http://gamesalad.com/forums/topic.php?id=10142

This method is much more flexible than the Animate behavior. It allows you to adjust frame rates on the fly, pause the animation midstream, as well as play the animation forwards or backwards.

Hope this helps!

Use this for whatever you want!

Joe
Fire Maple Games

Comments

  • millerbrother1millerbrother1 Member Posts: 108
    @FiremapleGames is the best! Thanks for all the fantastic tutorials. I hope to one day contribute as much back to the GS community as you do.

    CJM
  • synthesissynthesis Member Posts: 1,693
    This is actually really clever FMG. Great idea. I can use this in Toxic Roach as I wanted to adjust the speed of the roach animations depending on their velocity.

    My concern would be if the timer causes too much overhead if used liberally compared to an animation script.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    If you want to take it to the next level, I would actually use self.Time instead of a Timer.
    Same concept, but should be a little better.
  • netdzynrnetdzynr Member Posts: 296
    One other feature of timer-based animation mentioned to me by FMG, if true, is a major advantage: lower memory use. Apparently loading an actor with an animation behavior has a higher memory requirement because all frames of the actor are loaded in memory for the animation to run. When using a timer and swapping the image of an actor, the memory required is (I assume) only that of the largest image of the animation (only one image is referenced at a time). This seems quite plausible to me, but FMG can chime in and say whether I've stated this correctly.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    If you use the Change Image or Animate behaviors, GameSalad will go through your code and "preload" the images into RAM.

    So when you start a Scene, all of those images are already added to the Images RAM usage total.

    This is usually OK.

    However, if, let's say, your animation is a part of some "you win!" animation - and the player does not win - well, those images were loaded needlessly.

    Using Change Attribute gives you a little more control over when the RAM gets allocated.

    And more importantly, the Scenes load faster.
Sign In or Register to comment.