HUD - Bindings

9 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
€93.84
List Price:  €131.38
You save:  €37.54
£80.95
List Price:  £113.34
You save:  £32.38
CA$137.04
List Price:  CA$191.86
You save:  CA$54.82
A$154.99
List Price:  A$216.99
You save:  A$62
S$136.27
List Price:  S$190.79
You save:  S$54.51
HK$783.50
List Price:  HK$1,096.94
You save:  HK$313.43
CHF 91.19
List Price:  CHF 127.67
You save:  CHF 36.48
NOK kr1,101.37
List Price:  NOK kr1,541.96
You save:  NOK kr440.59
DKK kr700.13
List Price:  DKK kr980.21
You save:  DKK kr280.08
NZ$169.21
List Price:  NZ$236.90
You save:  NZ$67.69
د.إ367.23
List Price:  د.إ514.14
You save:  د.إ146.90
৳10,965.37
List Price:  ৳15,351.96
You save:  ৳4,386.58
₹8,334.23
List Price:  ₹11,668.26
You save:  ₹3,334.02
RM477.95
List Price:  RM669.15
You save:  RM191.20
₦125,683.43
List Price:  ₦175,961.83
You save:  ₦50,278.40
₨27,806
List Price:  ₨38,929.52
You save:  ₨11,123.51
฿3,703.32
List Price:  ฿5,184.80
You save:  ฿1,481.48
₺3,259.92
List Price:  ₺4,564.01
You save:  ₺1,304.09
B$516.59
List Price:  B$723.25
You save:  B$206.66
R1,923.67
List Price:  R2,693.22
You save:  R769.54
Лв183.31
List Price:  Лв256.64
You save:  Лв73.33
₩137,775.97
List Price:  ₩192,891.88
You save:  ₩55,115.90
₪378.18
List Price:  ₪529.46
You save:  ₪151.28
₱5,754.62
List Price:  ₱8,056.70
You save:  ₱2,302.07
¥15,478.45
List Price:  ¥21,670.45
You save:  ¥6,192
MX$1,711.89
List Price:  MX$2,396.72
You save:  MX$684.82
QR364.36
List Price:  QR510.13
You save:  QR145.76
P1,383.88
List Price:  P1,937.49
You save:  P553.61
KSh13,448.65
List Price:  KSh18,828.65
You save:  KSh5,380
E£4,807.48
List Price:  E£6,730.67
You save:  E£1,923.18
ብር5,687.89
List Price:  ብር7,963.28
You save:  ብር2,275.38
Kz83,485.81
List Price:  Kz116,883.48
You save:  Kz33,397.66
CLP$95,253.47
List Price:  CLP$133,358.67
You save:  CLP$38,105.20
CN¥724.60
List Price:  CN¥1,014.47
You save:  CN¥289.87
RD$5,894.01
List Price:  RD$8,251.85
You save:  RD$2,357.84
DA13,445.45
List Price:  DA18,824.17
You save:  DA5,378.72
FJ$227.71
List Price:  FJ$318.80
You save:  FJ$91.09
Q777.29
List Price:  Q1,088.24
You save:  Q310.94
GY$20,903.54
List Price:  GY$29,265.80
You save:  GY$8,362.25
ISK kr14,104.58
List Price:  ISK kr19,746.98
You save:  ISK kr5,642.40
DH1,013.18
List Price:  DH1,418.50
You save:  DH405.31
L1,782.83
List Price:  L2,496.04
You save:  L713.20
ден5,776.11
List Price:  ден8,086.79
You save:  ден2,310.67
MOP$806.39
List Price:  MOP$1,128.98
You save:  MOP$322.58
N$1,907.39
List Price:  N$2,670.43
You save:  N$763.03
C$3,677.32
List Price:  C$5,148.40
You save:  C$1,471.07
रु13,326.11
List Price:  रु18,657.10
You save:  रु5,330.98
S/368.16
List Price:  S/515.44
You save:  S/147.28
K379.71
List Price:  K531.61
You save:  K151.90
SAR375.04
List Price:  SAR525.07
You save:  SAR150.03
ZK2,580.25
List Price:  ZK3,612.45
You save:  ZK1,032.20
L466.96
List Price:  L653.76
You save:  L186.80
Kč2,370.96
List Price:  Kč3,319.44
You save:  Kč948.48
Ft36,978.60
List Price:  Ft51,771.52
You save:  Ft14,792.91
SEK kr1,088.71
List Price:  SEK kr1,524.24
You save:  SEK kr435.53
ARS$87,217.91
List Price:  ARS$122,108.57
You save:  ARS$34,890.65
Bs692.87
List Price:  Bs970.05
You save:  Bs277.17
COP$390,680.46
List Price:  COP$546,968.27
You save:  COP$156,287.81
₡50,009.58
List Price:  ₡70,015.41
You save:  ₡20,005.83
L2,466.51
List Price:  L3,453.22
You save:  L986.70
₲740,348.57
List Price:  ₲1,036,517.61
You save:  ₲296,169.04
$U3,852.35
List Price:  $U5,393.45
You save:  $U1,541.09
zł405.43
List Price:  zł567.62
You save:  zł162.18
Already have an account? Log In

Transcript

Welcome back everyone in this video we're gonna pick right up where we left off in the last one. The focus on this one is to create some HUD binding So in the last one, we created a couple of functions here update health and update Manoj and even made some test scripts in order to see this actually affect our health meters and our manometers etc. We'd actually bind these two variables over in our w BP HUD asset. So if you don't already have your W b p HUD asset open, this is where you can find it in your content browser content Metroidvania widgets w BP HUD so double click on that guy to open them up. And before we even get rolling with all that I do have a little bit of a mistake over here in our head that I want to correct. What you'll notice here if I select our man meter, let me select my man a meter widget over there.

And let me just scroll on down the Details panel, I'm just gonna move the percentage on down, you can see that this background image is man, a background image is not sized appropriately. And I recognized that when we were building this out and promised we'd come back and fix it. So that time has come. So I'm going to select my man a background widget here really quickly. And what I failed to do is in the render transform section of parameters right down here in the Details panel, come under transform the scale value, we want to set the scale for the x and y to be 1.4 in the X and 1.4 in the y and that should be size pretty appropriately. So now that if we take our man a meter and fill it all the way up to 100% it should have a nice border around it.

That is all well and good. All right. Now on to the next stuff. What we're going to do first is we're going to jump on over into our Graph tab. You got a couple of event nodes in here, we're going to delete the event pre construct. And we're going to delete out our Event Tick.

And we are going to do something off of event construct which you could kind of think of like an Event Begin Play for a normal blueprint. What we're going to do off of this is I'm going to right click, I'm going to get player character. Player index is zero is us, and then I'm going to offer the return value cast to our BP player. And in doing this, I will be able to get a reference to our player and store it in a variable. So I'm just going to right click here on our as BP player, we're going to promote this to a variable a new Variable shows up over here. And I'm going to call this simply player.

So this will store our BP player into a variable. In fact, I'm just going to put in a comment box here, left click and drag type that C key reference to player. I'm going to compile in save this right away. And I did this for a reason, because it's going to give me a little bit of a shortcut now to bind some of our variables to our various HUD elements. So I'm going to jump back over here to our Designer tab. And let's see, the first thing I want to bind to a variable is going to be our health meter here.

So make sure you've got this pink bar selected, that is your health meter widget. And down to the Details panel, we want to find our percent this is what we want to bind to a variable. So if we click right over here, where it says bind, we know now have this sub object properties for player because we created in a reference to our player. Now if we come under our player, lo and behold, we have this health percentage variable that we can read directly from our player. So let's plug this in straightaway. And now this should be bound to our health percentage value that we have within our BP player.

You know what, let's test this out right away. We don't have this number hooked up at all, but the meter should start decreasing bit by bit when I press the H key according to our test script, we should be reducing our incoming health by 10% 10 Health all the time. So let's just go ahead and try this. Clicking play by tap that H key you can see that pink bar moving down little bit by a little bit. Okay, so that is working well and good. So that's First step, jump back to your W BP HUD.

So with that, I want to change this value next. So our health current text widget, let's scroll up. And we want to bind this text to a widget. Let's come under bind. We've got our player here. And Huh, can't find anything here.

So what could I do? Well, what we can do is we can create a binding. Okay, let's create a binding here. This is going to jump us on over to our Graph tab, where we're prompted to create a function. I don't like these function names. So I'm going to hit f2 right here and I'm simply going to call this get current health.

Okay. Now you see the return value here is looking for a text value. This differs from our BP Player health current, which is a float value, so that's why we weren't able to find that directly from our w BP HUD. But there's a way that we can extract that information here and plug it into our return value. All we need to do is get our player character by right clicking in some empty space, right click Get Player Character. We will cast to our will cast to our BP player.

Make sure we hook in this wire like so. And now that we can talk to our VP player here, we can drag off of this and say get health current. Now this is a float output. But if we plug this float output into this text input, it will bring in a conversion node to convert that float value to text. Okay, so let's Compile and Save And then give this a play. So now when I type the H key, that is our h event, you should see the meter decreasing by 10 10%.

And you should see the numerical value there, the 100 decreasing by 10 as well, here we go 90 8070 6050 4030 2010 zero. And notice I cannot go below zero because I clamped that value from ever falling below zero. So pretty sweet. We're on our way. Next, let's address our Amana meter. Go ahead and select your man meter widget.

And over in the Details panel, where we've got this percent, let's bind this and here we can bind it to our player, man a percentage. Okay, I'm going to trust it that's going to work right away so I'm not going to jump in and play right away. Next, let's go ahead and take our Manoj current widget that is this numerical value printed over the top, we're going to scroll up to the top where this text is, we're going to bind this we're going to create a binding here, it's going to jump us on over to the Graph tab, prompt us to name this particular function, I'm gonna click on it, hit f2 and call it get current. manna. And we can do just like we did before, where we right click, we're going to get that player character. Player index zero is us.

So we're going to drag off of here, cast to our b p player. And now that we are able to communicate to our BP player we can extract the value of a variable from it. So let's drag out a here and do a search for manna currents we want to get man a current like so. Plug that into the return node and plug this directly into the return value to bring in the conversion node. And that should be all well and good let's Compile and Save and play. So now I got my H key for the hell so I'll do that first you can see the health decreasing.

Now how about the M key here we go 12345 it's all decreased as well as that the meter and the text is decrease and I cannot go below the number zero in either so guys job well done in this one we have finished binding some variables to our HUD for the time being anyways, next up, we got some HUD animations. So we'll see you 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.