Page 1 of 1
Animation bug?
Posted:
Sun Jul 27, 2008 4:42 am
by yttermayn
When you use the ChangeAnimation function in a script, it seems like the initial value of animpos will be either zero or whatever the last frame is. If animpos was a non-zero number prior to using the ChangeAnimation function, then whenever an animation is selected, animpos will be reset to zero. But if animpos is already a zero, it will be set to whatever the last frame of the new sequence is. This happens whether you ChangeAnimation to the same sequence or a different one. See the included .ged file to see this in action. Note that this does not occur when changing to an animation (as opposed to a sequence)
I guess my question is: is this behavior supposed to be happening? Am I doing something wrong?
Re: Animation bug?
Posted:
Sun Jul 27, 2008 4:53 am
by DST
A couple things:
To continue on the current animpos use 'no change'
ChangeAnimation("Event Actor", "newanimationname", NO_CHANGE);
using Forward Should reset it to the first frame.
You can also use 'wait for frame action' when you click ok to enter the action; then you can specify which animpos.
You can also set the animpos immediately after using the animchange; all actions in one script window will be executed in the same frame. (draw frame that is, 30/fps etc).
Also, if you want to upload a ged file to the forum, you HAVE to include the data folder, or no one can open it.
Re: Animation bug?
Posted:
Sun Jul 27, 2008 5:08 am
by yttermayn
Doh! My apollogies. Here's everything... And thanks for the info so far. I will try your suggestions.
Re: Animation bug?
Posted:
Sun Jul 27, 2008 5:24 am
by yttermayn
Update: I'm finding that despite setting animpos to zero in the next line following the ChangeAnimation function, it still somehow jumps to the end of the sequence. But if I set animpos to a non-zero value in the line just before, the new sequence will start off at zero. Thoughts?
Re: Animation bug?
Posted:
Sun Jul 27, 2008 5:49 am
by DST
it has something to do with your animation position being stopped.
If you were changing images by animpos with a stopped animation, you'd just chuck them all into one animation and command animpos out of that;
otherwise,
when i changed creatactor to animationdirection: Forward
and then used 'no change' on the keydowns, it worked perfectly.
And when i used 'forward' on the keydowns, it reset to 0 every time.
I can see what you're saying about the 0 and 4 thing, but i don't think its important.
How are you planning to use this?
Re: Animation bug?
Posted:
Sun Jul 27, 2008 3:42 pm
by yttermayn
I was using both animpos = x statements and sequence animations. I kept running into these problems with animation until I figured out what exactly was happening. Now I am trying to use only animation sequences, but inserting an animpos = 1; statement just before any ChangeAnimation's so I always know the new sequence will start at zero. I did have a workaround involving something similar to your suggestion about using only animpos with a stopped animation, but it makes for a lot more scripting that could be handled much easier using sequences. My philosophy is to make the already written functions and stuff in GE do as much of the work as possible.
I got my game animations working again this morning, now that I have a much more precise knowledge of the animation functions and variables. Now, on to collision detection!
...sigh...