i attached my work. Basically i have 2 versions of a code. One is for the PC and when you hold UP arrow the character moves up. The other is for the phone that has a touch screen button. But when u hold this touch button it doesn't move Look in the PlayerControl script in the EnableMoveUp function. Thank you
Can you post the code into the OP? Go into 'Go Advanced' in the edit screen, click the 'code' icon and copy/paste it.
just focus on the Update and EnableMoveUp function, i THINK thats where problem is Code (csharp): @script RequireComponent( CharacterController ) var onscreentext : GUIText; // Touch Screen Buttons var UP_Button : OnScreenButtons; var DOWN_Button : OnScreenButtons; // Player var movement = Vector3.zero; var moveSpeed : float; var character : CharacterController; private var thisTransform : Transform; // Ladder var LadderT : LadderTriggers; var LadderM : LadderTriggers; var LadderB : LadderTriggers; var canClimbUp : boolean = false; var canClimbDown : boolean = false; var ClimbingUp : boolean = false; var ClimbingDown : boolean = false; var grounded : boolean; function Start() { // Cache component lookup at startup instead of doing this every frame thisTransform = GetComponent( Transform ); character = GetComponent( CharacterController ); } function OnEndGame() { // Disable joystick when the game ends UP_Button.Disable(); DOWN_Button.Disable(); // Don't allow any more control changes when the game ends this.enabled = false; } //:::::::::::::::::::::::::::::: U P D A T E ::::::::::::::::::::::::::::::::::::::: function Update() { grounded = character.isGrounded; // ------------ LADDER TRIGGERS LadderControls(); // Actually move the character thisTransform.Translate( movement * Time.deltaTime ); } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //::::::::::::::::::::::::::::: L A D D E R C O N T R O L S :::::::::::::::::::::::::::::::: function LadderControls() { // Ladder Triggers // On Bottom of Ladder if ( LadderB.onBottom ) { canClimbUp = true; canClimbDown = false; // On Middle of Ladder }else if( LadderM.onMiddle !LadderB.onBottom ) { canClimbUp = true; canClimbDown = true; // On Top of Ladder }else if( character.isGrounded LadderT.onTop ) { canClimbUp = false; canClimbDown = true; } // Enable UP if( canClimbUp ){ EnableMoveUp(); // Enable UP and DOWN }else if( canClimbUp canClimbDown ){ EnableMoveUp(); EnableMoveDown(); // Enable DOWN }else if( canClimbDown ){ EnableMoveDown(); } } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //::::::::::::::::::::::::::::: E N A B L E M O V E - U P :::::::::::::::::::::::::::::::::: function EnableMoveUp() { if(UP_Button.position.y == 1 !LadderT.onTop){ onscreentext.text = "Should be moving up"; ClimbingUp = true; movement = Vector3(0, 1, 0) * moveSpeed; }else{ ClimbingUp = false; } if(Input.GetKey("up") !LadderT.onTop){ ClimbingUp = true; movement = Vector3(0, 1, 0) * moveSpeed; }else{ ClimbingUp = false; movement.y = 0; } } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //::::::::::::::::::::::::::: E N A B L E M O V E - D O W N :::::::::::::::::::::::::::::::: function EnableMoveDown() { if(DOWN_Button.position.y == -1 !LadderB.onBottom){ onscreentext.text = "DOWN"; ClimbingDown = true; movement = Vector3(0, -1, 0) * moveSpeed; }else{ ClimbingDown = false; } if(Input.GetKey("down") !LadderB.onBottom){ ClimbingDown = true; movement = Vector3(0, -1, 0) * moveSpeed; }else{ ClimbingDown = false; movement.y = 0; } } //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::