i have part of the script done but i don't know how to make the up arrow from jumping go to just upward movement.
Script:
function OnTriggerStay(hit : Collider)
{
if(hit.tag == "Vinetrig" && Input.GetKeyDown(KeyCode.UpArrow))
{
PlatformerController.canControl = false; //Turns off normal controls
//What should i put here to make the player "walk" upwards on the y axis?
}
}
Depending on how complicated you want your movement to be, you could do something simple like:
function OnTriggerStay(hit : Collider)
{
if(hit.tag == "Vinetrig" && Input.GetKeyDown(KeyCode.UpArrow))
{
PlatformerController.canControl = false; //Turns off normal controls
cachedCharacterController.Move(Vector3.up * climbSpeed * Time.deltaTime); //Link to the character controller
//If you use Input.GetAxis, you can have the player move up or down without writing twice as much code.
}
}
Maybe, for some reason you can't but if you setup a vertical input in the input manager, then you will be able to save writing an identical function for the down.
//Moves player up and down.
function OnTriggerStay(hit : Collider)
{
if(hit.tag == "Vinetrig" && Input.GetAxis("VerticalAxis")) //Is the user
//pressing up or down.
{
PlatformerController.canControl = false; //Turns off normal controls
cachedCharacterController.Move(Vector3.up * Input.GetAxisRaw("VerticalAxis") * climbSpeed * Time.deltaTime); //Link to the character controller
//Move based on the value of the input.
}
}