- Home /
Question by
bearded_pete · Apr 10, 2014 at 06:01 AM ·
overridesprite sheetssprite sheet
How do I override a row of my sprite sheet ?
I am using a simple code that runs a row of the sprite sheet dependent on a key press. This works great for running side to side (row 1), and jumping (row 2) if I am standing still. However, if I jump and them move right row 1 will take over even if row 2 has not played through ( row 0 is an idle animation). How do I fix this? Here is the code:
pragma strict
function Start () {
}
function Update () {
var AT =gameObject.GetComponent (animateTexture);
if(Input.GetKey("left")){
AT.rowNumber = 1;
}
else if(Input.GetKey("right")){
AT.rowNumber = 1;
}
else if(Input.GetKey("space"))
{
AT.rowNumber = 2;
}
else {
AT.rowNumber = 0;
}
}
Thank you for your help.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613142402im_/https://answers.unity.com/themes/thub/images/avi.jpg)