Hi,
I'm not sure if this is the best place to ask this, but I'm hoping someone has done something similar before. I'm using SM2 and I want to enable the run animation when the arrows are hit. The problem is, in my implementation it actually always draws the static texture when it's moving, then starts the run when an arrow is released. Perhaps someone has some code examples of doing user input with SM2. Thanks in advance.
var moveSpeed : float;
function Update () {
var packedSprite : PackedSprite = gameObject.GetComponent("PackedSprite");
if ( (Input.GetKeyDown(KeyCode.RightArrow)) || (Input.GetKeyDown(KeyCode.LeftArrow)) ) {
packedSprite.PlayAnim("Run");
transform.Translate(Input.GetAxisRaw("Horizontal") * Time.deltaTime * moveSpeed, 0, 0);
} else {
packedSprite.RevertToStatic();
}
}