Back Dash - Script #1

16 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 begin putting the script necessary to make our BP player back dash. This one's going to be spread out over a couple of videos here. So let's jump right to it. First thing we need to do is jump into our project settings, which we can find right across the top of our toolbar here. Let's go to project settings. And over on the left hand side, I'm going to select input, we're going to add a new action mapping here we've got one for jump, interact, exit in the skill acquire.

I'm going to add a new one by clicking the plus button right here next to action mapping, not access mapping. A lot of people get these confused action makin mapping, hit the plus button, and I will call this new action mapping simply back dash. Now I need to bind certain buttons to it and I'm going to bind get pad face button. This is for all you gamepad people out there gamepad face button top, right there. So for those of you with an Xbox controller, that'll be the Y button, those of you like on a PlayStation controller, that would be the triangle button. I'm also going to bind this to another key, clicking the plus button right here.

And I'll set this to be the up key on my keyboard. So again, you can set this to be whatever you want, but I've got some arrow keys on my keyboard that I'm using to kind of replicate the diamond shape on a game controller. So upkeep is going to be the equivalent here. Okay, so with that done, we can close out of our project settings. Next, I'm going to jump on over to our BP player located in content, Metroidvania blueprints characters, open her up because we need to add some more variables inside of here is if we don't have enough already. So these are going to go into our skill backed dash category.

Currently, we've only got two variables inside here. So let's create a new variable. And this one is going to be called B is back dashing. And with that created over on the right hand side in the Details panel, I'm going to put this in the category of our skill backed dash. And I'll compile here right away. And by default, it is false and I want it to be false.

Now we could add a tooltip here, um, I'm not going to put one just for the sake of time, but this one this variable is going to be used in our persona editor in order to help direct which animation we want to play. So when this does turn true, we're going to know which animation we want to trigger a back dashing type of animation. So this one is going to be solely for determining which animation our character is going to play. I'll reorder these variables when I'm done. Finish here, but I'm going to go ahead and click plus variable to add another one right away. This one is going to be called be back dash.

Ready? Question mark. And I probably should have put a question mark at the end of my other ones here too, because that's the way I like to label my Boolean variables. But with this one selected, be back dash ready over in the Details panel. We'll put this into our skill BAC dash category. And if I compile here, I will say that by default it is ready.

Now what are we going to be using this one for? Well, our back dash ability will have a little bit of a hidden cooldown, this is going to determine if the ability has cooled down and the player is able to back down again. So by default, I want them to be able to back dash immediately. Okay, so that one's going to be used for that purpose. Okay, another variable here, click plus variable, this one is going to be called back dash cooldown. And I'm going to change this to be a float variable, you could change it here or you can change it up over here in the Details panel.

I will put this over into our skill backslash category I will compile so I can add a default, our cooldown between back dashes is going to be point 235 seconds. Again, this is something that you can fiddle with once we get the script for this together. That's what I found to be pretty good through some play testing. So this is going to be the amount of time that must pass before you can back dash again. Otherwise, you're going to be able to spam our back dash button and just back dash repeatedly very rapidly. Okay, next one, we're going to add here, under variables plus variable, this one is going to be called back dash left amount.

This is going to be a vector variable. Over in the Details panel, I am going to put this in the appropriate categories skill back dash. I am going to make this instance editable, meaning that we can update this variable when we are running the game as well from the main editor, so we're going to check that to instance editable, I'm going to compile here and my back dash left amount, I'm going to set the x value to be negative 20. Now what we're going to be using this variable for is to determine when our character back dashes how far they move in the x axis. So that's what that was for the left amount. Likewise, I am going to select this variable once again, when it is yellow like this.

I can hit Ctrl w on it to duplicate it. And I'm simply going to rename this right amount back dash right amount because I duplicate it once it was in the appropriate category, it's already there. So all I need to do is compile here and for the backlash right amount, I'm simply going to set the x value to be positive 20. We can leave the x and y be for those. Okay, let me just do a little bit of reorganization of my variables here. So I've got B has back dash, I'm actually going to add question mark at the end of that.

Okay. Then I'm going to have B is back dashing, gonna drag and drop that up above here, and I will also put a question mark at the end of that. Then we've got B back dash ready, I'm lumping all my bulls here together. Then I'm gonna have back dash cool down right above that and then back dash, left them out left click and drag that on top of here to move that up and then write them out left click and drag. Okay, and so I am happy with That. Alright, on to some scripting.

Let's see, let's put this in our move set tab, we've currently got our jump script in here our landing script in here. If you don't remember, you can access your different graphs over here. In the My Blueprint panel, we've got our Event Graph and we created a new graph for moveset. So let's do our script for our back dashing here in our move set, tab. Okay, so earlier in the video we created and events for input back dash, so I'm gonna scroll over to the right here, leave a lot of space over here. I'm gonna zoom on up by control and mouse wheel and right click, and I'll just do a search for back dash.

If I can spell it right there is our action event for back dash that we added to our project settings. Now after this, I want to say once we've pressed this, let's bring in a branch. We want to if valuate some things. And there's three things that we want to evaluate if they are true before we're going to say yes, you can back dash. So firstly, I want to check does our character even have the back dash skill. So drag and drop this variable in here, we're going to get that.

The next thing I want to check if our be back dash ready is set to true. And the other thing I want to check is our character movement. Let's bring this guy in from our components panel. gonna drag that in, then drag off of that and say is falling. And then we're gonna drag off of this and say not and we're looking for not Boolean right there. So the three things that we want to check are true and I'm gonna go like that.

You can drag off of any one of these three right here, I'm gonna drag off my has back dash and type in the end, or type in the word that I'm looking for in and Boolean. So I want to see if we have the back dash, and our back dash is ready. And I can click to add another pin here. And we are not falling if all three of these. If all three of these are true, then I am going to drag off of here and put in a sequence node because there's a few things that we want to do if all of these things are true. So the first thing I'm going to do off of our then zero is I'm going to deal with our cooldown.

So we're going to take our back dash ready. This Boolean right here now make sure because a lot of these are very similarly named Make sure you're getting the correct one. I'm going to bring in our be back dash ready, drag it in here, we're going to set this in right away if our back dash is ready, which it is by default, and our character starts back dashing, the first thing we're going to say is Nope, he's not ready anymore. So that's gonna prevent us from spamming our back dash ability. And then what I'm gonna do is I'm going to drag off of this and bring in a delay node. In our delay, the duration of this is going to be our back desk cooldown.

You can drag and drop this right on the pin here. And if you remember our back dash delay here is point three five seconds. So after that delay of point three, five seconds, we're going to bring in our back dash ready again, or you can copy and paste this node, select it Ctrl C Ctrl, V. And after point three five seconds has passed, we can set this to true again So we can back dash after that. I'm gonna left click and drag around these three nodes right here, left click, drag, tap that C key, and I'm going to type in back dash. Cool down to prevent player spamming this skill. Okay, so with that in place, then we need to work off of the then one portion of our sequence node.

And off of this, I'm going to set his back dashing this one right here, B is back dashing, we're going to left click in drag, put that in here we want to set this hooking that into our sequence node if we're going to set this to true, and again, this is what's going to inform our state machine that our characters should be playing a back dashing type of animation. So we're setting that to true right away. Then what I want to do is I want to bring in another branch. Let's do the shortcut for branch, hold down the B key and left click, there's our branch. And we want to evaluate some condition. The condition that I want to evaluate at this point of our script is which way our player is facing.

So we know if they should be back dashing to the left or to the right. So I'm going to bring in my capsule component up here to help out with that drag and drop that into our graph. And then I'm going to drag off of there and I'm going to say get world rotation. Okay, and we want to evaluate it. So what I'm going to do is I'm going to drag off of this and type in a greater than symbol Sorry, I'm gonna split this first before I can actually just evaluate straight away here. When I needed to do here's I need to right click on our return value here and split the struct pin because rotation is made up of three possible rotations, X, Y, or Z rotation depending on which axis you want to check.

So again, to get that all I did was I right clicked on the pin, and there'll recombine it, I right clicked here and said, split the struct pin, because rotation is made up of three separate rotations, rotational values. So I want to evaluate if we are rotated in the z axis that's kind of a line straight down through our character. So I'm going to drag off of this. Type in the greater than symbol and I want to do a float greater than or equal to and I'm going to right click on this node and leave a node comment for is facing right If it's greater than or equal to zero, that's going to be our condition here. If that is true, we're going to do something on here. And if that is false, we're going to do something out of here.

Now for debug purposes, what you could do is let's right click and bring in an Event Tick right here. Then I'm going to drag off of this into a print string. And I'm simply going to drag off of our return values z from our get world rotation here and plug it directly into our in string here, and it's kind of overlapping that right away. And what this is going to do that's going to every tick here, let us know our characters rotation here, so it'll be facing right if our z rotation here is greater than or equal to zero, so I'm just going to jump in and play here. longer, left hand side of the screen, you're seeing zeros. And if I turn you can see it's basically negative 180.

So our character is facing right, as indicated by our little debug script. Okay, I'm gonna delete that because I don't really need to see that. Just in case you want to see what value something is outputting you can do something like that. Okay, with this bit of script down, I'm just going to bring this all on screen so you can see what we've built so far. So we've built all these variables along the left hand side here, we've got three Boolean, two vectors, a float, and of course, our struct from earlier. This is a script that we've currently put together, double check it here.

Pause the video if you need to make sure you've got the appropriate things checked. Let's Compile and Save. We're not done with this yet, but we've got a good start. Let's continue on in the next video. We'll see you there.

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.