Double Jump - Jump Script

19 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€92.78
List Price:  €129.90
You save:  €37.11
£79.40
List Price:  £111.16
You save:  £31.76
CA$136.11
List Price:  CA$190.56
You save:  CA$54.44
A$154.13
List Price:  A$215.78
You save:  A$61.65
S$135.08
List Price:  S$189.12
You save:  S$54.03
HK$782.28
List Price:  HK$1,095.23
You save:  HK$312.94
CHF 90.61
List Price:  CHF 126.85
You save:  CHF 36.24
NOK kr1,085.23
List Price:  NOK kr1,519.37
You save:  NOK kr434.13
DKK kr692.01
List Price:  DKK kr968.84
You save:  DKK kr276.83
NZ$167.80
List Price:  NZ$234.94
You save:  NZ$67.13
د.إ367.19
List Price:  د.إ514.08
You save:  د.إ146.89
৳10,976.08
List Price:  ৳15,366.96
You save:  ৳4,390.87
₹8,339.52
List Price:  ₹11,675.66
You save:  ₹3,336.14
RM473.25
List Price:  RM662.57
You save:  RM189.32
₦141,842.81
List Price:  ₦198,585.61
You save:  ₦56,742.80
₨27,810.04
List Price:  ₨38,935.18
You save:  ₨11,125.13
฿3,647.70
List Price:  ฿5,106.92
You save:  ฿1,459.22
₺3,232.12
List Price:  ₺4,525.11
You save:  ₺1,292.98
B$499.21
List Price:  B$698.91
You save:  B$199.70
R1,908.54
List Price:  R2,672.04
You save:  R763.49
Лв180.65
List Price:  Лв252.92
You save:  Лв72.26
₩135,197.71
List Price:  ₩189,282.20
You save:  ₩54,084.49
₪368.63
List Price:  ₪516.10
You save:  ₪147.47
₱5,633.91
List Price:  ₱7,887.71
You save:  ₱2,253.79
¥15,144.47
List Price:  ¥21,202.86
You save:  ¥6,058.39
MX$1,659.40
List Price:  MX$2,323.22
You save:  MX$663.82
QR364.31
List Price:  QR510.04
You save:  QR145.73
P1,370.91
List Price:  P1,919.33
You save:  P548.42
KSh13,148.68
List Price:  KSh18,408.68
You save:  KSh5,260
E£4,729.52
List Price:  E£6,621.52
You save:  E£1,892
ብር5,680.63
List Price:  ብር7,953.11
You save:  ብር2,272.48
Kz83,612.74
List Price:  Kz117,061.18
You save:  Kz33,448.44
CLP$97,978.20
List Price:  CLP$137,173.40
You save:  CLP$39,195.20
CN¥722.95
List Price:  CN¥1,012.16
You save:  CN¥289.21
RD$5,921.50
List Price:  RD$8,290.34
You save:  RD$2,368.83
DA13,490.83
List Price:  DA18,887.70
You save:  DA5,396.87
FJ$226.12
List Price:  FJ$316.58
You save:  FJ$90.46
Q779.86
List Price:  Q1,091.83
You save:  Q311.97
GY$20,923.51
List Price:  GY$29,293.76
You save:  GY$8,370.24
ISK kr13,946.60
List Price:  ISK kr19,525.80
You save:  ISK kr5,579.20
DH1,013.19
List Price:  DH1,418.51
You save:  DH405.32
L1,763.34
List Price:  L2,468.75
You save:  L705.40
ден5,702.11
List Price:  ден7,983.18
You save:  ден2,281.07
MOP$805.89
List Price:  MOP$1,128.28
You save:  MOP$322.39
N$1,893.44
List Price:  N$2,650.90
You save:  N$757.45
C$3,681.15
List Price:  C$5,153.75
You save:  C$1,472.60
रु13,335.63
List Price:  रु18,670.42
You save:  रु5,334.78
S/370.84
List Price:  S/519.19
You save:  S/148.35
K382.72
List Price:  K535.82
You save:  K153.10
SAR375
List Price:  SAR525.01
You save:  SAR150.01
ZK2,522.76
List Price:  ZK3,531.96
You save:  ZK1,009.20
L461.43
List Price:  L646.02
You save:  L184.59
Kč2,350.75
List Price:  Kč3,291.15
You save:  Kč940.39
Ft36,729.02
List Price:  Ft51,422.10
You save:  Ft14,693.08
SEK kr1,071.30
List Price:  SEK kr1,499.86
You save:  SEK kr428.56
ARS$85,766.82
List Price:  ARS$120,076.98
You save:  ARS$34,310.16
Bs691.04
List Price:  Bs967.48
You save:  Bs276.44
COP$387,583.68
List Price:  COP$542,632.66
You save:  COP$155,048.97
₡50,832.34
List Price:  ₡71,167.31
You save:  ₡20,334.97
L2,468.78
List Price:  L3,456.40
You save:  L987.61
₲737,805.73
List Price:  ₲1,032,957.54
You save:  ₲295,151.80
$U3,781.90
List Price:  $U5,294.82
You save:  $U1,512.91
zł400.73
List Price:  zł561.05
You save:  zł160.31
Already have an account? Log In

Transcript

Welcome back everyone. In this video, our goal is to edit our existing jump script to allow our player the ability to double jump, we've gotten to a point where we can interact with all of these diocese and collect a skill but the skill that we collect is actually not functional yet our player so these next bunch of videos are going to be making some of these skills actually function. So the first thing you should do is find your BP player located inside of our Metroidvania blueprints characters folder. Double click on her to open her up. And the first thing I'm going to do is I'm going to create a few more variables. I know we've got a lot of variables in here, but we got a few more to create.

So I'm just going to click this plus variables button. And the first variable I'm going to create is going to be called B lowercase b is double jumping question mark. Now with that created, I am going to move this into the category of our skill jump, skill double jump right there. So you can see that it is in our skill double jump category just because I'm super anal like that. I'm gonna just reorganize this by dragging and dropping it to be next to our other Boolean variable. Now, what are we going to be using this one for we're actually going to be using this in a little bit of our scripts here in a little bit.

But what this one is going to be doing is it is going to be a variable that gets passed on to something called an animation blueprint to make or to instruct our character to actually play another jumping animation. So this is laying some of the groundwork for that. Okay, with that one created, I'm going to create a nother variable here, plus variable This one I am going to call jump count. This coming up over my Details panel will be in integer whole number. And I'm going to put this into our skill double jump category as well. And I'm going to drag this above my double jump data just to be organized.

Next I'm going to add another variable, this one is going to be called double jump velocity. And this is going to be a vector variable. And I will also put this in the same category of skilled double jump going to drag and drop it above like so. And then I am going to compile because I've got some default values I need to set in here. I'm going to start with our double jump velocity since we already have it selected here. I'm going to set our z velocity here to be 1200.

And you're going to see this variable coming to play here in just a little bit. Our jump count we want that to be at zero by default in our is double jumping, not has double jump, but our B is double jumping, that is going to be false by default. Okay, so next what you need to do is we are going to jump over to our jump script that we already have existing. And again, we're inside of our BP player and we are in our move set tab. If you remember from earlier in the course we move some of our jump functionality over to this move set tab. If you can't find this, it is located just going to scroll up in my My Blueprint panel if you come under graphs, move set that is where you should be able to find this bit of jump script that we currently have existing.

Okay, so what I need to do is give our A little bit more space here. So I'm going to move my landing script on down a little bit. And I'm going to take my comment box for our jump script. I'm just going to expand this out because we're gonna add some more scripts inside of here. I'm gonna move this stop jumping a little bit further down like this. Okay, so the first thing that I'm going to do is I'm going to move this off to the right, and I'm going to bring in a branch node right about here, and I'm going to hold down the B key B as in boy, left click.

And I'm going to say once we press our jump button, we're going to go into our branch. And now the first question I want to ask is, do we have our skill double jump. So here we've got this variable has double jump, and by default, it is false. But when we interact with our blueprint actor, which one is our skilled double jump, double jump right they're gonna double click on this guy inside of our BP skilled double jump when we interact with this thing. This is where we are going to find out Hey, do we already have double jump? Sorry, that's the wrong area.

Let me just scroll on down here a little bit. It is in our player acquires double jump within here we are setting our has double jump to true. Okay, so jumping back over to our BP player. That's the question we're asking when we jump, hey, do we even have the ability to double jump, so make sure that you're plugging in the appropriate Boolean variable here, our B has double jump. We're gonna drag and drop that on top of our condition like so. And out of the false branch, from here, we can plug this into the branch that we already Had existing previously.

This was checking to see if we were falling. And if that was false, we would allow the player to jump in play the jump up FX. Okay. off of the true branch, what I want to do is drag out a wire and search for a switch on int node, you can type that into the search bar here and this is the one you're looking for switch on int. Now what this node does, it takes an input here, it takes an integer input. And depending on what the value of this integer input is, we can fire out of different pins and we can add more pins along the right hand side here by clicking one time by clicking a second time because I'm gonna have what to do on our first jump and then second jump.

Now for our selection here, I want to plug in our jump count. Drag and drop that right on top of there. Okay, so we're going to be working off of our zero pin here, if our jump count is currently zero, which it is by default, then what I want to do is a bunch of this stuff down here, I can literally copy all these nodes right here, our character movement are is falling our branch, our jump function and our jump up FX. So I'm gonna hit Ctrl C. And then I'm gonna come up here and do Ctrl V. And so if our jump count is zero, I'm going to wire this in like so. And then what I'm going to do is I'm going to take our jump count here, bring it on over, I'm going to get the jump count. And then I'm going to drag off of our jump count and I'm going to hit the plus symbol, not plus six, but just plus.

And you've got this node here called increment int. This is kind of a special node in that, when it will automatically do is it's going to add one to our jump count. There's another way that you could do this. And I could say jump count, plus, and I could do integer plus integer. And then I could say plus one, and then I could drag our jump count right here to set that. And I could do something like this.

Instead, if I just unhook this, this is this setup right here will give you the exact same result. As this increments, int node right here is just kind of like a shortcut. Okay, so that is going to then make our jump count be one. And if we then press our input action jump again, it's gonna say hey, do we have the ability to double jump if we do and our jump count? Now one, after we've jumped one time over here, we can then fire out of here. Now note that even at this point if I was to jump in and play, and I was to interact with our Dyess here to learn our double jump skill exiting out of there and then I hit the spacebar.

If I try to double jump, it is not going to allow me to So note that that is still going to be broken at this point because we're not finished. Okay, the next thing we need to do is work off of our one branch here and we're going to let me flip over my page a notes. The first thing well, I'm actually going to move this little bit of scripts out of the way a little bit more. Okay, the first thing we're going to do off of this one branches, I'm gonna get another reference to our jump count. We're gonna get that And then just like we did before, I'm going to drag off of that hit the plus symbol, and I'm going to do an increment int. So immediately after we've jumped one time, and we come through here, we're going to say, hey, increment our jump count to be two.

And off of doing this, I'm going to bring in our B is double jumping, we're going to drag that in, make sure that it's the appropriate Boolean is double jumping, and I'm going to set this and I'm going to set this to be true. Now this is going to come into play a little bit later on the importance of this, but what this is going to instruct our character to do is to play another jumping animation. Okay, so it actually looks like they're kind of jumping off of midair. So that's going to come into play in a little bit. Okay, next what I'm going to do is I'm going to bring in our character movement component, you can drag and drop that guy in here in office, of this you're gonna drag off of here and you're gonna say get velocity. It's at the very bottom when you type in get velocity.

Inside of our character movement component, if I select that in, in the details panels, do a search for velocity. You've got these velocity settings right here. So all I'm doing here is I'm saying, hey, character movement, I want to access your velocity settings. So what I can do with this is I can right click on this velocity pan right here, if you right click on that, you can split this struct pin, like so. And what that'll do is transform the nodes look like this. And now you have access to the velocity x, y and the Z. I'm going to bring this up a little bit because off of my character movement component, once again I want to drag off and I want to set velocity And make sure that this execution wire is hooked in like so.

But off of this velocity input here, too, I'm going to right click, and I'm going to split the struct pin. What I want to do is I want to say, hey, I want the X to remain the same, I want the Y to remain the same, although the Z i want to zero that out in order to make this double jump work, like I want it to. I want to zero out the characters, z velocity, that's the speed at which they're, they're falling or rising. And the reason I am doing this is in order to make this look right, I experiments, this retesting, you have to zero out the Z velocity. Then what we can do is we can do this cool thing by dragging off of here, called launching the character there's a function called launching the character. And all we need to do here.

Since our target is ourselves, our VP player is feed it a launch velocity. Well that's why I created this double jump velocity variable because I want to make our z launch velocity be 1200. So I can drag and drop that right on top of our launch launch velocity right there. And then the rest of this I'm just gonna extend this out a little bit more is going to be a little artistic flair, some VFX and sound effects. So off of our launch character, I'm going to drag out a wire, type in a play sound. We'll do a 2d sound Sure.

Even though we could do a localized down to the sounds are easier. And the sound that I want to put in here is going to be called start. simulate q That guy right there. The tooltip will show you the path that it's in. It's in some of the engine content folder. So I'm going to slot this in.

But if you don't have access to this and wondering how did I get that if you come under your view options right here in your drop down, you can check show engine content on and that'll make sure that this sound effect is available to you. Okay, so then after that, I'm going to spawn emitter at location. I want a little particle effects play. And I want this to play. The emitter that I want to play here is going to be p underscore hammer sparks. And that was located in my Infinity Blade effects pack if you're wondering where that one came from, And the place that I want this effect to play is going to be essentially at my character's feet.

So if I jump over to my viewport here, and I've got this jump VFX spawn point that's basically at my my character's feet right there. So I'm going to jump back over to my moveset tab, I'm going to bring in a reference to that, that I'm going to drag off of here and say I want to get the world location of that. That's where I want to be spawning this visual effect. Okay, and then in addition to that I want to do like I did before, where I'm going to call our jump effects function that we created earlier. Flipping my page Oh notes. Then what I'm going to do is I'm going to put in a very, very short delay, very tiny delay Drag off here, do a search for delay node.

I'm going to set a delay of point 05 seconds. And then this is double jumping center that I had before. Well, I set it to true right here. And I'm doing this again just to make it so that our character can eventually play another jumping animation. Over here, I'm going to make it so that our is double jumping, we're going to set that one more time. I'm going to set it to be false.

So again, make sure that you've got this Boolean, appropriately set to false and that it is the B is double jumping. And let's jump in and play and test this out. So our characters going to currently Well, I can jump, I cannot double jump. Right? But I'm going to interact with our skill dice here to learn double jump. Okay, now it says that I've Learn double jump.

Now you'll notice something I will be able to double jump now, one, two, but you'll notice a couple things. One when I did that my character didn't play an animation on that second jump and secondly, if I hit the spacebar, I cannot double jump. Again. No worries on that we are going to fix that up very, very soon here. Let me give you one last look at the script here before we close this out so you can see where our jump script is currently at if you need to slow down the video or pause it. This is where our jump script is currently at.

Make sure that you've got the has double jump in this branch has double jump. We're switching on in here our dump jump count is zero by default. Off the zero branch we're checking to see if our character is falling. Here we are incrementing our jump count Coming back to our switch on and off the one branch, we're going to increment our jump count again. Here we are setting our is double jumping Boolean that we created earlier. Again, this is going to come into play for calling a second jump animation.

Here we're briefly zeroing out our characters z velocity, and then launching the character up into the air. If you really want to have some fun and see how high you can set your or make your character double jump, fiddle with that Z value to make your character double jump as high as you want her to jump. Then we're playing a 2d sound. Start simulate, there is our hammer spark VFX we're spawning that at our jump VFX spawn point. Then we're calling our jump up effects function delaying and then setting our is double jump here to false Alright, and then off of this first branch if we don't have the double jump, all we're going to do is just see if our characters falling and then jump in playing the jump effects. Okay guys, that is going to do it for now.

We will see you all in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.