- Home /
Playing an animation when press left mouse key - Using Orthello JavaScript
Hi guys I am currently having some trouble with playing an animation of my 2D sprite punching. I followed some of the other questions asked on here, however known seem to be using the Orthello program that helps with 2D. my code currently is:
if(Input.GetButtonDown("Fire1"))
{
transform.animation.Play("Punch");
}
this doesnt appear to be liked and nor does "gameObject.animation.Play("Punch");" I have also just simply had it as "animation.Play("Punch");" but then i get an error saying no animation attached, even though there is.
It would be great to get some help...thanks
Answer by Loius · Oct 18, 2012 at 06:37 PM
I'd recommend reading Orthello's documentation. I don't have any experience with it but I know that 'animation' is a reserved word in MonoBehaviours - it refers to the actual Animation component attached to the game object.