Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: A-Hed on Wed 02/03/2005 18:26:10

Title: Character walking step by step?
Post by: A-Hed on Wed 02/03/2005 18:26:10
Ok, this is my first post in any of technical threads. I was wondering if it is possible to script so that my maincharacter is walking one step at a time without stopping in the middle of any of the steps depending on where I clicked for him to walk.

For example: if I want the character to walk to the other side of a table then this script should calculate so that he comes as close as possible to the point where I clicked without him stopping during a step (unless if he must turn to some direction and continue walking).

Is this possible to script? If it isnt, is there another way around this problem?
Title: Re: Character walking step by step?
Post by: Pumaman on Wed 02/03/2005 22:40:22
I'm not really sure what you mean. In what way is he currently "stopping during a step"?
Title: Re: Character walking step by step?
Post by: Chicky on Wed 02/03/2005 23:00:22
What he means is he wants it so when the character gets to the spot where the player clicked he will have finished atleast one full cycle of the walking animation and will end on the last frame of that cycle. He doesnt mind if the character goes over the exact spot where the player clicked a little as long as the animation has a chance to get to the end of the cycle.

Currently if you have a 6 frame walk cycle, and the character reaches the place where the player clicked on frame 3 then the character sprite will suddenly go to the standing frame for the character.

Ahed wants the character to have a chance to finish the walk cycle up to frame 6 and THEN go to the standing frame, thus meaning that the character may have to go slightly over where the player clicked in order to finish the cycle.
Title: Re: Character walking step by step?
Post by: Rui 'Trovatore' Pires on Thu 03/03/2005 10:16:29
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=17991.0

YOke gives a nice idea, you can try and expand on it.
Title: Re: Character walking step by step?
Post by: A-Hed on Thu 03/03/2005 10:47:26
Thanks Rui! I will try what YOke said, thanks to Chicky also for making making clear of what I was asking for.  :)
Title: Re: Character walking step by step?
Post by: YOke on Thu 03/03/2005 14:49:32
You know where I'm at, so just give me a shout if you're stuck. ;)
Title: Re: Character walking step by step?
Post by: Pumaman on Thu 03/03/2005 19:04:19
Ah, ok, thanks for the clarification.

Well, it's not all that simple to do since the character's path is only calculated up to the destination point, so it would have to extrapolate a new path to continue moving him.

And what would happen if the character ran up against a non-walkable area mid-cycle? Would the animation continue and "animate on the spot" until the standing frame came round?
Title: Re: Character walking step by step?
Post by: Gilbert on Fri 04/03/2005 02:38:52
Quote from: Pumaman on Thu 03/03/2005 19:04:19
Would the animation continue and "animate on the spot" until the standing frame came round?
I think that's what should happen, the logic is when the character stopped moving, check whether the loop reaches the last frame yet, if not AnimateCharacter() from the current frame to the end then back to standing frame (unless you move him again or call other character graphics related functions before the animation stops).
I don't know if this is easy to implement or not, but I think it may be made a game option.