Animation Best Practice?

TotalityNodeTotalityNode Member Posts: 5
edited September 2012 in Working with GS (Mac)
Hello GameSaladers,

I don't need any advice on drawing animation - got the 'frame by frame' covered. What I am wondering about though, is the application of frames within GameSalad.

I've seen 'programmatic animation' alluded to on the forums, where non-timer timers are apparently used to replace the Animate behaviour (with superior results?).

Can anyone point me at a tutorial or working example of 'programmatic animation' within GS? My Google Fu has failed me on this one.

Many thanks in advance!

Best Answer

  • MarkOnTheIronMarkOnTheIron Posts: 1,447
    Accepted Answer
    I'm using that method extensively on a project and so far the results are amazing.

    Here's a sample display of how the rule works:

    image

    The "Mod" attribute is a self attribute and I've set it at 0.02. On this example the animation is composed of 12 frames and it runs at 20 fps (one frame every 0.05 seconds).

    The great thing of this method is that it allow you to change the fps during runtime, you just have to replace the 0.05 with an attribute that you can change whenever you want.

Answers

  • RPRP Member Posts: 1,990
    There is are many threads on this topic. Your search is a bit more complicated than it needs to be. Search for: methods for animation in gamesalad. I think what you may be referring to is the useage of the interpolate behavior. Again, there are pre existing threads and videos on youtube (and the GS cookbook).

  • TotalityNodeTotalityNode Member Posts: 5
    Thanks, @RP, but 'Interpolate' is not what I'm asking about here. I'm asking about using self.time based coded timers to animate, as mentioned briefly in this thread:

    http://forums.gamesalad.com/discussion/44707/timers-are-for-chumps-gs-optimization-tips
  • TotalityNodeTotalityNode Member Posts: 5
    To whit, a quote from the @domenius Timers Are For Chumps thread:

    "I've been able to create iterations as quick as every 0.04 seconds with this sort of calculation with no issue, fast enough for very smooth programatic animation or constrain-like updates on background attributes. In fact, I recommend using these sorts of timers for animation instead of the standard animate function, it seems to play smoother and being able to adjust the animation parameters at runtime can be particularily useful for complex actors."

    I am specifically looking for a tut or working example of this kind of animation.
  • RPRP Member Posts: 1,990
    Ah, I know the thread, but don't recall ever seeing anyone make anything on this yet.

    Honestly, unless you are running into problems, I would not go to extremes to try to figure this out just yet. When used properly in conjunction with timers, attributes, and any additional behaviors the animate behavior works VERY well. Even with the limitations and hurdles found in the GS creator many of the animated train wrecks out there are the result of bad code and image export options.
  • TotalityNodeTotalityNode Member Posts: 5
    Gotcha, thanks @RP.

    Ah well - maybe someone who has used this will pop up at some point. @domenius himself, even!
  • TotalityNodeTotalityNode Member Posts: 5
    Excellent, that's the stuff! Many thanks @MarkOnTheIron, I'll get to try this out tomorrow. This'll be perfect for a character whose ƒPS will change according to their horizontal speed.

    Thanks again!
  • domeniusdomenius Member Posts: 108
    You got the idea, using a variable to update the frame is super fast and allows for smoother animation than the gs animate behavior can manage IMO. I use a similar rule in place of every animate in my code, which improved performance heavily as well as allowing for easier manipulation of animations, especially when you want to tie animation in to a particular value such as power, speed, etc.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Yes Tynan did a thread some time ago showing how the animate behavior's fps is not accurate. It is obviously not tied to the system clock.
  • RPRP Member Posts: 1,990
    edited September 2012
    Oh crap, I think I have a link to that old tread somewhere. @Tynan had that conversion list on that thread too. I'll try to find it once I get back in, if someone does not find it first.
  • RPRP Member Posts: 1,990
    Okay, I found that thread. Most of the meat is on page 2.

    http://forums.gamesalad.com/discussion/40335/gss-animate-is-screwed/p1
Sign In or Register to comment.