(solved) Stop character animating

Started by Radiant, Sun 27/10/2013 16:13:12

Previous topic - Next topic

Radiant

Suppose a character is animating when I leave the room. Then I set that character's room to my current room, and he'll appear and will be still animating. Now I'm curious how to make him stop doing that. StopMoving() doesn't stop a character from animating, and neither does setting his loop and frame to zero (he'll simply keep on animating in loop zero). There is no StopAnimating() command, so how do I stop the char from animating?

EliasFrost

The way I did it was to lockviewframe() to the default frame (in my case it was frame 0) and then unlock the view again (unlockview()). I don't know if there are other ways, but that's how I did it.

monkey0506

How exactly are you animating the character? The typical way is to use LockView (or one of its variants) and then call UnlockView when you're finished.

It would be relatively easy to handle this generically if you never wanted characters to enter a new room while animating (simply loop through them calling UnlockView), but it seems like that's a bit overkill for your situation.

Radiant

Well, characters have a standard view; the first four loops are reserved for walkcycles, anything else can be used as an animation. So lockview isn't used because a character's view usually doesn't change.

Construed

Create an Idle loop with only 1 frame in it and switch it to that frame along with the StopMoving(); command.
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Khris

Radiant: I strongly recommend using a second view for the animations. You could run into all kinds of problems otherwise.

I don't remember exactly what happened to me, all I know is that the problem instantly vanished as soon as I moved the animations to a second view.

Andail

I also keep a separate view for the walking loops, since that will allow me to regain control of my character with a simple UnlockView() command.
I'm not sure what other issue can arise - the ones Khris mention - other than perhaps diagonal loops running if you have forgotten to turn off diagonal walking.

If this is a huge problem, why not just run the loop an additional time, but with the eOnce parameter, before fade-in (room_load)?

TheBitPriest

I'm with Khris.  I've struggled with this a bit myself, and have been able to use state variables as a kludge. Although, I haven't used AGS as long as the rest of you, I think Khris' comment would make a fine addition to a "best practices" document.

Radiant

Well, I'm not going to rewrite an entire game using a second view for all characters :)  It has not been my experience that not doing so runs into issues, other than this one which is pretty obscure. It appears if I use lock/unlock when entering the room, it works again. Thanks for the advice!

TheBitPriest

:-D  Yes.  We want to play it...  Don't rewrite it!

SMF spam blocked by CleanTalk