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
€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 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.