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
€95.85
List Price:  €134.19
You save:  €38.34
£79.54
List Price:  £111.35
You save:  £31.81
CA$143.73
List Price:  CA$201.23
You save:  CA$57.50
A$159.93
List Price:  A$223.91
You save:  A$63.97
S$135.54
List Price:  S$189.77
You save:  S$54.22
HK$777.83
List Price:  HK$1,089
You save:  HK$311.16
CHF 89.34
List Price:  CHF 125.09
You save:  CHF 35.74
NOK kr1,131.88
List Price:  NOK kr1,584.68
You save:  NOK kr452.80
DKK kr715.08
List Price:  DKK kr1,001.15
You save:  DKK kr286.06
NZ$176.75
List Price:  NZ$247.46
You save:  NZ$70.70
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳11,945.33
List Price:  ৳16,723.94
You save:  ৳4,778.61
₹8,493.77
List Price:  ₹11,891.62
You save:  ₹3,397.85
RM450.75
List Price:  RM631.07
You save:  RM180.32
₦154,938.50
List Price:  ₦216,920.10
You save:  ₦61,981.60
₨27,824.38
List Price:  ₨38,955.25
You save:  ₨11,130.86
฿3,419.79
List Price:  ฿4,787.84
You save:  ฿1,368.05
₺3,519.01
List Price:  ₺4,926.76
You save:  ₺1,407.74
B$608.53
List Price:  B$851.97
You save:  B$243.44
R1,830.80
List Price:  R2,563.19
You save:  R732.39
Лв187.32
List Price:  Лв262.25
You save:  Лв74.93
₩144,627.53
List Price:  ₩202,484.33
You save:  ₩57,856.80
₪365.39
List Price:  ₪511.57
You save:  ₪146.17
₱5,882.91
List Price:  ₱8,236.31
You save:  ₱2,353.40
¥15,643.93
List Price:  ¥21,902.13
You save:  ¥6,258.20
MX$2,007.58
List Price:  MX$2,810.70
You save:  MX$803.11
QR364.41
List Price:  QR510.19
You save:  QR145.78
P1,381.63
List Price:  P1,934.33
You save:  P552.70
KSh12,923.70
List Price:  KSh18,093.70
You save:  KSh5,170
E£5,087.81
List Price:  E£7,123.14
You save:  E£2,035.32
ብር12,764.56
List Price:  ብር17,870.89
You save:  ብር5,106.33
Kz91,790.82
List Price:  Kz128,510.82
You save:  Kz36,720
CLP$98,905.10
List Price:  CLP$138,471.10
You save:  CLP$39,566
CN¥729.56
List Price:  CN¥1,021.42
You save:  CN¥291.85
RD$6,087.13
List Price:  RD$8,522.23
You save:  RD$2,435.09
DA13,485.25
List Price:  DA18,879.89
You save:  DA5,394.64
FJ$231.62
List Price:  FJ$324.28
You save:  FJ$92.66
Q770.23
List Price:  Q1,078.35
You save:  Q308.12
GY$20,913.67
List Price:  GY$29,279.97
You save:  GY$8,366.30
ISK kr13,911.60
List Price:  ISK kr19,476.80
You save:  ISK kr5,565.20
DH1,006.07
List Price:  DH1,408.53
You save:  DH402.46
L1,836.70
List Price:  L2,571.46
You save:  L734.75
ден5,900.06
List Price:  ден8,260.33
You save:  ден2,360.26
MOP$800.26
List Price:  MOP$1,120.39
You save:  MOP$320.13
N$1,840.36
List Price:  N$2,576.58
You save:  N$736.22
C$3,678.42
List Price:  C$5,149.94
You save:  C$1,471.51
रु13,597.49
List Price:  रु19,037.04
You save:  रु5,439.54
S/372.23
List Price:  S/521.13
You save:  S/148.90
K405.36
List Price:  K567.52
You save:  K162.16
SAR375.62
List Price:  SAR525.88
You save:  SAR150.26
ZK2,766.46
List Price:  ZK3,873.15
You save:  ZK1,106.69
L477.10
List Price:  L667.96
You save:  L190.86
Kč2,408.98
List Price:  Kč3,372.68
You save:  Kč963.69
Ft39,689.03
List Price:  Ft55,566.23
You save:  Ft15,877.20
SEK kr1,103.13
List Price:  SEK kr1,544.43
You save:  SEK kr441.30
ARS$102,160.40
List Price:  ARS$143,028.65
You save:  ARS$40,868.24
Bs690.76
List Price:  Bs967.10
You save:  Bs276.33
COP$435,928.80
List Price:  COP$610,317.76
You save:  COP$174,388.96
₡50,434.81
List Price:  ₡70,610.75
You save:  ₡20,175.94
L2,537.51
List Price:  L3,552.62
You save:  L1,015.10
₲779,455.88
List Price:  ₲1,091,269.42
You save:  ₲311,813.53
$U4,474.38
List Price:  $U6,264.31
You save:  $U1,789.93
zł408.66
List Price:  zł572.14
You save:  zł163.48
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.