Question by
KreeperGaming · Aug 14, 2016 at 07:30 AM ·
animationjavascriptgunfirst person shooterwasd
Walk animation wont play but idle will
Hi!,
I am making a FPS game but my walk animation won't work, when i press W,A,S, or D, my gun just jerks
heres my script(In javascript):
function Update() {
if (Input.GetKeyDown(KeyCode.W)) {
GetComponent.<Animation>().CrossFade("Walk");
}
else if (Input.GetKeyDown(KeyCode.A)) {
GetComponent.<Animation>().CrossFade("Walk");
} else if (Input.GetKeyDown(KeyCode.S)) {
GetComponent.<Animation>().CrossFade("Walk");
} else if (Input.GetKeyDown(KeyCode.D)) {
GetComponent.<Animation>().CrossFade("Walk");
}
else {
GetComponent.<Animation>().CrossFade("idle");
}
}
So, like I said, My idle animation will play, but when I press WASD, it just has the gun jerk, then okays the idle again, even if I hold WASD.
thanks.
Comment
Your answer
Follow this Question
Related Questions
bullet destroy on collison 1 Answer
Journey like terrain modification 0 Answers
I want my character to enter and exit car with animation 1 Answer
Player attacking enemy script 0 Answers
How to add first person animations in a third person character? 0 Answers