- Home /
Character Animation Assistance
hey guys... I'm looking for some help with my character animation script so far it is:
#pragma strict
function Start () {
}
function Update()
{
if (Input.GetAxis("Vertical") > 0.2)
animation.CrossFade ("walk");
else if (Input.GetAxis("Vertical") < 0.2)
animation.CrossFade ("idle");
if (Input.GetKeyDown ("space"))
animation.Play ("jump");
else if (Input.GetKeyUp ("space"))
animation.CrossFade ("idle", 1);
else if(Input.GetAxis("Vertical") < -0.2){
animation.CrossFade ("walk", - 0.05);
}
}
I apologize for the disorganization of my script but i need help with getting the player to complete the attack function on key "f". whenever i press it it plays for a brief second and then switches to idle. is there someway he will play the animation then switch to idle? please guys i need some help!
First mark your code and then press the Code sample button (the one with the 101010) to format your code snippet.
Answer by VivekD · Mar 15, 2013 at 07:01 AM
Instead of :
else if (Input.GetKeyUp ("space"))
try using :
else if (Input.GetKeyUp ("space") && animation.isPlaying("jump") == false)
i get an error "it is not possible to invoke an expression of type 'boolean'?
Your answer
Follow this Question
Related Questions
Need help addind a attack and jump script 0 Answers
Script does not work on version 4.6.0. 0 Answers
Adding a Controller, and setting up animations on a Prefab? 1 Answer
Characters Interaction with Mecanim Animations 2 Answers
Root motion / How to bake into pose Root Transform Position (x) 0 Answers