help with a stripped-down character animation

Started by MFrance, Sun 03/02/2008 07:14:57

Previous topic - Next topic

MFrance

Suppose I want to create a character who has only one view, containing only one short loop, that plays continuously whether that character is walking up/down/sideways or just standing still.  The part that I'm finding to be problematic is preventing the animation from stuttering when the character comes to a halt. 

Is there some way to finagle things so that the character's idle animation starts in a consistent frame when they stop walking? Or better yet, set things up so that the characters animation is entirely independent of their movements?

Thanks

Shane 'ProgZmax' Stevens

You could create your own walking functions (that directly manipulate the x/y position of the character) if you want an alternate behavior.  You could also store the .Frame number of the idle animation in a backup variable and then recall it when you want the idle animation to resume at its proper position (just set .Frame=frame_old).  From your description it sounds almost like you're modeling a bouncing ball or something constantly in motion, and something like that would be better handled by writing your own custom movement functions imo.

MFrance

#2
You're pretty close with the bouncing ball! It's actually a manic looking chap on a pogo stick who's always facing the camera. 

I'm not sure that I've currently the know-how to create my own walk function, but I guess I could do some homework. Of course if anybody wanted to give me a helpful nudge in the right direction....

EDIT: I suppose it's worth mentioning, in case it's not clear, that pogo-boy is the player character and not just some NPC I can script the behavior of ahead of time.

GarageGothic

The easiest way by far would be to use two characters. One invisible (transparency = 100) which would technically be the player character (who moves where you click, respecting walkable areas etc.) and one animated dummy character who follows the invisible character wherever he goes. The pogo animation could either be set as the dummy character's idle animation (with a delay of 0) or simply started using the Character.Animate with the eRepeat parameter.

If we assume the dummy character is called PogoBoy, then in your repeatedly_execute, you could put:

Code: ags
if (IsGamePaused() == 0) {
   cPogoBoy.x = player.x;
   cPogoBoy.y = player.y;
   }


Since the dummy character wouldn't actually "walk" anywhere, only have his coordinates updated, there's no need to worry about walking loops and whatnot, in effect fulfilling your wish to "set things up so that the characters animation is entirely independent of their movements".

MFrance


SMF spam blocked by CleanTalk