- Home /
Duplicate Question
Simple wall jump?
Im trying to make my character do sort of a double jump if it is facing a wall and if the player has pressed the spacebar twice. Ive looked around for an answer for this but they are all to confusing for my little brain to make sense of, can anyone help me out?
Can you show me the script you're using for just double jumping by pressing "space" ?
I dont have a double jump script, what I meant was for the character to do a double jump if it is facing a wall or not.
I guess this will help you http://spetools.de/code/aafceeac2b95ae7f86f8d684e8212036
this is for a side scrolling game, $$anonymous$$e is an fps free roa$$anonymous$$g sort of game.
Answer by OzzyRawrz · Apr 08, 2012 at 03:08 PM
First make an empty object and place it in the Player as a child then give a Box collider to the emptyObject Then Try using this script in the EmptyObject for Double jumping when the player face the wall.
var Player : Transform;
var FacingWallorNot : int;
function Update () {
if(FacingWallorNot == 1){
var PlayerMovement = Player.GetComponent(PlayerMovementAndJumpingScript);
//Change the variable in the PlayerMovementAndJumpingScript here using "PlayerMovement.[VariableName] = [number value you want it to change];
}
}
function OnTriggerEnter(other:Collider){
if(other.gameObject.tag == "Wall") {
FacingWallorNot = 1;
}
}
Put a "Wall" tag on the wall object.
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Simple wall jump 0 Answers
Wall jump need help!!!!! 1 Answer
Character does not jump 1 Answer
What is the simple way of applying Texture Atlas to Unity 3 Answers