Hello, I have being coding a script for PlayerStates to my controller has animations when it moves and i have been copying MRxTeaBag from youtubes script and i get errors that he doesn't
Assets/scripts/Player.js(18,17): BCE0044: expecting ), found '{'.
Assets/scripts/Player.js(30,1): BCE0044: expecting EOF, found 'else'.
also what does EOF mean?
I will show screenshots of my code:![alt text][1]
[1]: /storage/temp/18103-code+help+2.png
idk know if they are read able but my code is:
var PlayerState : float;
var PlayerAnimSec : GameObject;
function Update ()
{
PlayerStateController();
PlayerAnims();
}
function PlayerStateController()
{
if ((Input.GetAxis("Vertical") !=0 || Input.GetAxis("Horizontal") !=0))
{
if (Input.GetButton("Sprint")
{
PlayerState = 2;
}
else
{
PlayerState = 1;
}
}
else
{
PlayerState = 0;
}
}
function PlayerAnims()
{
if (PlayerState == 0)
{
PlayerAnimSec.animation.CrossFade("Idle Animation", 0.4);
}
else if (PlayerState == 1 )
{
PlayerAnimSec.animation.CrossFade("Walking Animation", 0.4);
}
else if (PlayerState == 2 )
{
PlayerAnimSec.animation.CrossFade("Sprint Animation", 0.4);
}
}
↧