Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: on Sun 01/06/2003 05:11:16

Title: Moving Animations?
Post by: on Sun 01/06/2003 05:11:16
I want to make a NPC move away, but also be animating (but not the normal walk).  I've tried several things, but I can't seem to get the character to move AND animate, only one or the other.  I know when you tell the character to walk, it chooses a specific loop and plays that loop while moving in that direction, so is there a way to specify which loop to run while it moves?  Even if the code only works for objects, I can make do with that.

It would be nice if there was a code called AnimateMove(Character, Loop, X, Y) and AnimateMoveEx(Character, View, Loop, X, Y, Speed).  That would make it so much easier.
Title: Re:Moving Animations?
Post by: Scummbuddy on Sun 01/06/2003 13:50:06
Then you make your animation of the guy walking and doing whatever it is else that you want.then call the animation.

Remember, this is going to be a long (wide) animation with possibly lots of blank space from where the char is going to end up
Title: Re:Moving Animations?
Post by: Cerulean on Sun 01/06/2003 14:06:01
Make your different thing a view. Set the view, walk, release the view.
Title: Re:Moving Animations?
Post by: Scorpiorus on Mon 02/06/2003 16:18:12
Method 1.

What you could do is to make another character (INVISIBLE), assign him a transparent view (view consisting of transparent sprites) and move him as always. And for the original character (NPC) just run the animation and !repeatedly! update his co-ordinates to be equal to the transparent character's ones.

inside the repeatedly_execute:

//place NPC exactly to the co-ordinates where INVISIBLE is:
character[NPC].x = character[INVISIBLE].x;
character[NPC].y = character[INVISIBLE].y;



Somewhere in the script:

MoveCharacter(INVISIBLE, <x>, <y>);
SetCharacterView(NPC, <view>);
AnimateCharacter(NPC, <.......>);





Method 2.

Also you could just replace the walking loop with the needed one then run MoveCharacter() command. For example, if you want to animate the character when he walks down replace the view so that the loop number 0 represents the animation you want the character to perform.

The second method doesn't require to use another character but less comfortable in case you may want to run different animations or long animations (with run next loop after this) etc... as the engine takes all the work on itself to control animation process. Whereas in the 1st method you control the animation by yourself through the AnimateCharacter(Ex) function(s).


-Cheers