- Home /
Wall Jump script
Im making a 3d game on a 2d plain, i have a moving character who can jump but im looking for a wall jump stlye script. But i am a terrible at code the best i can do is figure out wrong syntax so i was wondering if any one could point me in the right direction on how to make one?
Answer by hypnoslave · Jan 01, 2011 at 06:58 PM
sorry, but You're going to have to code it. There's really no way around learning to code in unity.. Thankfully however, it's an amazingly easy way to start learning how to code.
my first (and verryyyy hacky) project, "I am the night", (http://www.greenergrassgames.com/iamthenight) used wall jump this way:
first of all, i used a switch in my code to build a state machine to track the player's current state (grounded, airborne, wallsliding)
the character had a box colider that stuck out in front of him a tiny bit, and that followed him around. this was set to "use trigger". if this trigger object ran into an object tagged as "wall" while the character was in his "airborne" state, AND the player pressed against or away from the wall with his arrow keys, the character would enter a "wallsliding" state -- where he quickly flips around 180 degrees, plays a "i'm sliding down a wall" animation and falls down vertically very slowly. if the user hits jump in this state, the character springs away from the wall with a simple add force function and plays a wall-jump animation. he then goes into the airborne state, ready to hit another wall.
hope that isn't too confusing. there are probably better ways to do it.
How do you make the character stick to the wall and slide down slowly? Normally I would get the collision contact point, invert the normal and add a constant force in that direction. However I have rotating wall and I dont't know how to make the player slide down slowly (wherever "down" is while the wall rotates).
Answer by Justin Warner · Jan 01, 2011 at 05:10 PM
If you want him to "Climb" over the wall, your going to have to animate it...
But you might want to define: wall jump.
Happy new years, and hope this helps =).
Your answer
Follow this Question
Related Questions
2D sprite that always faces the player? 1 Answer
Find distance within screen! 2 Answers
Advice needed on my first c# 2D jump script 1 Answer
Camerascript works strange! 0 Answers
Jump & Animation Script 2D 0 Answers