Animation woes: Problem... solved.

Started by Ghormak, Fri 01/07/2005 00:55:45

Previous topic - Next topic

Ghormak

EDIT 2: A good night's sleep does wonders. I've located the problem, I'll leave the post here in the unlikely case it'll be of use to someone else. The problem was that I was calling FaceLocation every tick on the main character, which of course resetted the current animation loop.

Original post:


Hello.

I'm working on something where you use the keyboard to move around, and therefore I don't want to use the built-in walking functions AGS provides.

The character moves (as in changes x and y positions) flawlessly. All is well.

Because I want total control of what I'm doing, I update the frames manually in the rep. exec, and it looks like this:

Code: ags

panim_timer++;
if(panim_timer >= 20) {
Ã,  panim_timer = 0;
Ã,  pframe++;
Ã,  if(pframe == 5)
Ã,  Ã,  pframe = 1;
Ã,  cEgo.Frame = pframe;
}


I've tested with continuously updating GUI labels and have confirmed that pframe does indeed tick at a steady pace from 1 to 4, and then it repeats. All is well.

HERE COMES THE PROBLEM!

The actual frame of the character does not correspond to the value of pframe. At all. Instead, it seems as if the animation loops through once every half a second or so at warp speed! This behaviour can also be seen in the GUI label I asked to display the value of cEgo.Frame (that is, the actual frame the animation is currently in).

What is also very strange is that cEgo.Frame stays at 0 most of the time, except during the millisecond it runs through the entire loop, even though pframe (the frames it SHOULD be displaying) runs from 1 to 4!

So my question is: is this a bug in AGS, or have I missed something brutally obvious? I have no ideas left.
Achtung Franz! The comic

SMF spam blocked by CleanTalk