Game Development Community

Mini Platformer Tutorial - animations

by John Winter · in Torque Game Builder · 11/07/2006 (2:18 pm) · 1 replies

Hello, I've got a bit of a problem that I'm hoping someone can help me with here. Specifically, as the title implies, I'm having difficulty getting the player animations to work in the Mini Platformer Tutorial. I have gone through the entire thing multiple times, as carefully and thoroughly as I can, and always ended up with the same result - Movement works fine, but I can never get the character to look like he's doing anything but the starting idle pose.

Could somebody possibly post a completed, working version of their player.cs file from this tutorial so I can take a look at it and see what I'm doing wrong? This has really been holding me back and it would be a huge help.

Thanks in advance.

#1
11/08/2006 (8:03 am)
Ah! yes you are getting the same problem than I did. What you need is to check your animation state BEFORE starting a new animation. Otherwise you will be always be starting the animation and therefore you will always be playing the first frame

so right now you are doing this
if (buttonpressed) {
startAnimation(walk)
} else {
startAnimation(iddle)
}

But you need to do this instead

$playerState="iddle"

if (buttonPress and $playerState!="walk"){
startAnimation(walk)
$playerState="walk"
}
else
{
if ($playerState!="iddle"){
startAnimation(iddle)
$playerState="iddle"
}
}

thats it!