Hey, in my 2D game, my character slides a little bit on the x-Axis after releasing the running buttons. I want him to stop immediately on the spot when the running animation fades out and Idle comes in. How do i do this?
i tried with velocity but its read-only...
thanks a lot!
At the moment its look this way, i thought about calling a function in the first else. But i dont know what i should contain^^
function LateUpdate () {
var controller : PlayerController = GetComponent(PlayerController);
//~ if (hasAnimations) {
// We are not falling off the edge right now
if (controller.GetHangTime() < hangTimeUntilFallingAnimation) {
// Are we moving the character?
if (controller.IsMoving() && isRunning)
{
animation.CrossFade ("run", 0.5, PlayMode.StopAll);
isLanding = false;
}
// Go back to idle when not moving
else {
if(isLanding == true && Time.time > tempTime)
{
isLanding = false;
Idle();
}
else
{
Idle();
}
}
}
}