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