okay so, im making a simple 2D platform game and i have this problem.
Basically i used the Animating tiled texture script from Unity to add a run, idle and jump animation to my player, heres what it looks like:
-----------------
#pragma strict
function Start () {
}
function Update () {
var at = gameObject.GetComponent(animatetexture); //Store AnimateTexture Script
if(Input.GetAxis("Horizontal")){ //Player moves left
at.rowNumber = 1; //Change to running animation
} else if(Input.GetAxis("Horizontal")){ //Player moves right
at.rowNumber = 1; //Change to running animation
} else if(Input.GetButton("Jump")){
at.rowNumber = 2; //Change to jump animation
} else { //Player doesnt move
at.rowNumber = 0; //Change to idle
}
}
------------------
but the problem is, when i jump and move left or right while still in the air, my jump animation stops and goes to the running animation, but if i were to press the space bar alone to jump, it works fine.
i also want to make my jump animation continue on until my player touched the ground ( so my fall animation as well)
please, i hope someone can help me figure out how to fix that, because it really bothers me lol
thank you!
Trending Articles
More Pages to Explore .....