From the course: Advanced Unity 2D: Platformer Player Movement

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Adding long jump

Adding long jump - Unity Tutorial

From the course: Advanced Unity 2D: Platformer Player Movement

Start my 1-month free trial

Adding long jump

- So now let's talk about a different type of jump. What we're gonna do is create a jump where if you press the button lightly he jumps a little bit, and if you jump and hold, he'll jump a little bit higher. This is a technique that is used in a lot of platformers to give the player a range a different type of jump motions in addition to the double jump that we had set up previously Now we're not gonna be able to add all these features into our existing jump, so what we're gonna do is also look at to how to extend an existing behavior and add additional login on top of it. Let's go into our Scripts folder and into Behaviors and create a new script called LongJump. We'll open up LongJump in MonoDevelop and now we'll need to add a few properties to manage the actual jump delay, the jump multiplier, and whether we can do the actual long jump and if the long jump is actually happening. To get started, let's create a public float and we'll call this longJumpDelay. Next, we'll create a…

Contents