Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualmk.jr.fan

Posted 12 October 2012 - 04:20 PM

Im new to Unity and I was using a tutorial to make a 2d platformer. Everything was going well until I tried to add jumping and crouching. For some reason I get this error when trying to run the game.
UnityException: Input Axis Veritcal is not setup.
To change the input settings use: Edit -> Project Settings -> Input
playerControls.Update () (at Assets/2D Mario Assets/Scripts/playerControls.js:66)

Im not sure why this happens but even when I go into input settings and try to change it, it still doesn't work.
It only seems to jump when pressing the left or right arrow keys(which is to move left and right) while pressing the jump keys.
Any idea on why this is happening?

[source lang="jscript"]var runSpeed : float = 6.0;var fallSPeed : float = 2.0;var walkJump : float = 6.3;var runJump : float = 10;var crouchJump : float = 12;var gravity : float = 20.0;var startPos : float= 0;var moveDirection : int=1;//aniPlay.aniSprite(16,16,0,0,16,12);private var velocity : Vector3 = Vector3.zero;function Update(){ var aniPlay=GetComponent("aniSprite"); var controller : CharacterController = GetComponent (CharacterController); if(controller.isGrounded) { velocity = Vector3(Input.GetAxis("Horizontal"),0,0); //Animation if (velocity.x==0 && moveDirection == 1) //idle right { aniPlay.aniSprite(16,16,0,0,16,12); } if (velocity.x==0 && moveDirection == 0) //idle Left { aniPlay.aniSprite(16,16,0,1,16,12); } if (velocity.x<0) //Walk left { velocity*=WalkSpeed; aniPlay.aniSprite(16,16,0,3,10,15); } if (velocity.x>0) //Walk Right { velocity*=WalkSpeed; aniPlay.aniSprite(16,16,0,2,10,15); } if (velocity.x<0 && Input.GetButton("Fire1")) //run Left { velocity *=runSpeed; aniPlay.aniSprite(16,16,0,5,16,24); } if (velocity.x>0 && Input.GetButton("Fire1")) //run Right { velocity *=runSpeed; aniPlay.aniSprite(16,16,0,4,16,24); } if (velocity.x ==0 && Input.GetAxis("Veritcal")<0) //Crouching { print("Crouching"); aniPlay.aniSprite(16,16,0,9,16,24); } //Movement if(Input.GetButton("Jump")&& !Input.GetButton("Fire1")) { velocity.y = walkJump; print("are you Here"); } if(Input.GetButtonDown("Jump") && Input.GetButton("Fire1")) { velocity.y=runJump; } } if (!controller.isGrounded) { velocity.x = Input.GetAxis("Horizontal"); velocity.x *= WalkSpeed; } if (velocity.x<0) //get last move Dir left { moveDirection=0; } if (velocity.x>0) { moveDirection=1; //get last move dir right } velocity.y-=gravity*Time.deltaTime; //apply gravity controller.Move(velocity*Time.deltaTime); //move the controller }[/source]

[source lang="jscript"] //Movement if(Input.GetButton("Jump")&& !Input.GetButton("Fire1")) { velocity.y = walkJump; print("are you Here"); } if(Input.GetButtonDown("Jump") && Input.GetButton("Fire1")) { velocity.y=runJump; } } if (!controller.isGrounded) { velocity.x = Input.GetAxis("Horizontal"); velocity.x *= WalkSpeed; } if (velocity.x<0) //get last move Dir left { moveDirection=0; } if (velocity.x>0) { moveDirection=1; //get last move dir right } velocity.y-=gravity*Time.deltaTime; //apply gravity controller.Move(velocity*Time.deltaTime); //move the controller }[/source]

#3mk.jr.fan

Posted 12 October 2012 - 04:18 PM

Im new to Unity and I was using a tutorial to make a 2d platformer. Everything was going well until I tried to add jumping and crouching. For some reason I get this error when trying to run the game.
UnityException: Input Axis Veritcal is not setup.
To change the input settings use: Edit -> Project Settings -> Input
playerControls.Update () (at Assets/2D Mario Assets/Scripts/playerControls.js:66)

Im not sure why this happens but even when I go into input settings and try to change it, it still doesn't work.
It only seems to jump when pressing the left or right arrow keys(which is to move left and right) while pressing the jump keys.
Any idea on why this is happening?

[source lang="jscript"]var runSpeed : float = 6.0;var fallSPeed : float = 2.0;var walkJump : float = 6.3;var runJump : float = 10;var crouchJump : float = 12;var gravity : float = 20.0;var startPos : float= 0;var moveDirection : int=1;//aniPlay.aniSprite(16,16,0,0,16,12);private var velocity : Vector3 = Vector3.zero;function Update(){ var aniPlay=GetComponent("aniSprite"); var controller : CharacterController = GetComponent (CharacterController); if(controller.isGrounded) { velocity = Vector3(Input.GetAxis("Horizontal"),0,0); //Animation if (velocity.x==0 && moveDirection == 1) //idle right { aniPlay.aniSprite(16,16,0,0,16,12); } if (velocity.x==0 && moveDirection == 0) //idle Left { aniPlay.aniSprite(16,16,0,1,16,12); } if (velocity.x<0) //Walk left { velocity*=WalkSpeed; aniPlay.aniSprite(16,16,0,3,10,15); } if (velocity.x>0) //Walk Right { velocity*=WalkSpeed; aniPlay.aniSprite(16,16,0,2,10,15); } if (velocity.x<0 && Input.GetButton("Fire1")) //run Left { velocity *=runSpeed; aniPlay.aniSprite(16,16,0,5,16,24); } if (velocity.x>0 && Input.GetButton("Fire1")) //run Right { velocity *=runSpeed; aniPlay.aniSprite(16,16,0,4,16,24); } if (velocity.x ==0 && Input.GetAxis("Veritcal")<0) //Crouching { print("Crouching"); aniPlay.aniSprite(16,16,0,9,16,24); } //Movement if(Input.GetButton("Jump")&& !Input.GetButton("Fire1")) { velocity.y = walkJump; print("are you Here"); } if(Input.GetButtonDown("Jump") && Input.GetButton("Fire1")) { velocity.y=runJump; } } if (!controller.isGrounded) { velocity.x = Input.GetAxis("Horizontal"); velocity.x *= WalkSpeed; } if (velocity.x<0) //get last move Dir left { moveDirection=0; } if (velocity.x>0) { moveDirection=1; //get last move dir right } velocity.y-=gravity*Time.deltaTime; //apply gravity controller.Move(velocity*Time.deltaTime); //move the controller }[/source]

#2mk.jr.fan

Posted 12 October 2012 - 04:18 PM

Im new to Unity and I was using a tutorial to make a 2d platformer. Everything was going well until I tried to add jumping and crouching. For some reason I get this error when trying to run the game.
UnityException: Input Axis Veritcal is not setup.
To change the input settings use: Edit -> Project Settings -> Input
playerControls.Update () (at Assets/2D Mario Assets/Scripts/playerControls.js:66)

Im not sure why this happens but even when I go into input settings and try to change it, it still doesn't work.
It only seems to jump when pressing the left or right arrow keys(which is to move left and right) while pressing the jump keys.
Any idea on why this is happening?

[source lang="jscript"]var runSpeed : float = 6.0;var fallSPeed : float = 2.0;var walkJump : float = 6.3;var runJump : float = 10;var crouchJump : float = 12;var gravity : float = 20.0;var startPos : float= 0;var moveDirection : int=1;//aniPlay.aniSprite(16,16,0,0,16,12);private var velocity : Vector3 = Vector3.zero;function Update(){ var aniPlay=GetComponent("aniSprite"); var controller : CharacterController = GetComponent (CharacterController); if(controller.isGrounded) { velocity = Vector3(Input.GetAxis("Horizontal"),0,0); //Animation if (velocity.x==0 && moveDirection == 1) //idle right { aniPlay.aniSprite(16,16,0,0,16,12); } if (velocity.x==0 && moveDirection == 0) //idle Left { aniPlay.aniSprite(16,16,0,1,16,12); } if (velocity.x<0) //Walk left { velocity*=WalkSpeed; aniPlay.aniSprite(16,16,0,3,10,15); } if (velocity.x>0) //Walk Right { velocity*=WalkSpeed; aniPlay.aniSprite(16,16,0,2,10,15); } if (velocity.x<0 && Input.GetButton("Fire1")) //run Left { velocity *=runSpeed; aniPlay.aniSprite(16,16,0,5,16,24); } if (velocity.x>0 && Input.GetButton("Fire1")) //run Right { velocity *=runSpeed; aniPlay.aniSprite(16,16,0,4,16,24); } if (velocity.x ==0 && Input.GetAxis("Veritcal")<0) //Crouching { print("Crouching"); aniPlay.aniSprite(16,16,0,9,16,24); } //Movement if(Input.GetButton("Jump")&& !Input.GetButton("Fire1")) { velocity.y = walkJump; print("are you Here"); } if(Input.GetButtonDown("Jump") && Input.GetButton("Fire1")) { velocity.y=runJump; } } if (!controller.isGrounded) { velocity.x = Input.GetAxis("Horizontal"); velocity.x *= WalkSpeed; } if (velocity.x<0) //get last move Dir left { moveDirection=0; } if (velocity.x>0) { moveDirection=1; //get last move dir right } velocity.y-=gravity*Time.deltaTime; //apply gravity controller.Move(velocity*Time.deltaTime); //move the controller }[/source]

#1mk.jr.fan

Posted 11 October 2012 - 06:20 PM

Im new to Unity and I was using a tutorial to make a 2d platformer. Everything was going well until I tried to add jumping and crouching. For some reason I get this error when trying to run the game.
UnityException: Input Axis Veritcal is not setup.
To change the input settings use: Edit -> Project Settings -> Input
playerControls.Update () (at Assets/2D Mario Assets/Scripts/playerControls.js:66)

Im not sure why this happens but even when I go into input settings and try to change it, it still doesn't work.
It only seems to jump when pressing the left or right arrow keys(which is to move left and right) while pressing the jump keys.
Any idea on why this is happening?

PARTNERS