Change Animation side effects??
Posted: Sun Nov 02, 2008 11:28 am
I have this code to make my character jump:
It's on my KeyDown event (I allow for double jumps). I works perfectly. my character jumps as you would expect.
Now I want to change the character animation to a "jumping" animation. If I add this:
Things start to get weird. The "jumping" animation kicks in, but the character does not move up (like yvelocity has been set back to zero). Pushing the up key twice (the second while the "jumping" animation is on) does make the character jump. I've tried different ways to achieve this with no success. I'll post my project if requested
There are more sophisticated things I'd like to do, like detecting that the character is falling and change the animation accordingly, but I'm starting on the most basic problem.
- Code: Select all
if (jumping != 0)
{
yvelocity = -8;
jumping -= 1;
}
It's on my KeyDown event (I allow for double jumps). I works perfectly. my character jumps as you would expect.
Now I want to change the character animation to a "jumping" animation. If I add this:
- Code: Select all
if (jumping != 0)
{
yvelocity = -8;
jumping -= 1;
ChangeAnimation("Event Actor", "s-jumpl-1", FORWARD);
}
Things start to get weird. The "jumping" animation kicks in, but the character does not move up (like yvelocity has been set back to zero). Pushing the up key twice (the second while the "jumping" animation is on) does make the character jump. I've tried different ways to achieve this with no success. I'll post my project if requested
There are more sophisticated things I'd like to do, like detecting that the character is falling and change the animation accordingly, but I'm starting on the most basic problem.