I am trying to play a specific clip on input. I want it to change clips, from the idle (it starts out as this clip) to the Begin Run clip. I have a animated sprite with both of these clips included. I think there is a simple syntax for this but I just can’t figure it out.
I’ve tried this code, John is the name of the player object,
function Update (){
if(Input.GetKey == "d"){
player.transform.position += Vector3(forwarddirection, 0,0);
John.Play ("Begin Run");
}
}
I’ve tried 2dTK’s example for playing specific clips
function Update (){
if(Input.GetKey == "d"){
player.transform.position += Vector3(forwarddirection, 0,0);
Tk2dAnimatedSprite.Play ("Begin Run");
}
}
I’ve even tried the name of my animated sprite
function Update (){
if(Input.GetKey == "d"){
player.transform.position += Vector3(forwarddirection, 0,0);
AnimatedSprite.Play ("Begin Run");
}
}
None of it works. Should I be using a static sprite batcher instead of an animated sprite? please help.
I forgot to note, you must configure for java script before this will work in java script. That was another problem I had.
– rednax20hi im having same problem I think what do u mean define a variable which variable please help im having troubles and cant figure out
– ger122