Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,256 --> 00:00:03,072
We've got viles in place and we've got
2
00:00:03,328 --> 00:00:07,168
Experience being counted based on the files that you've picked up
3
00:00:07,424 --> 00:00:11,008
Missing is the ability of the enemies to drop The Voice
4
00:00:11,520 --> 00:00:15,616
And so we're going to do that and we're going to do that in a manner
5
00:00:15,872 --> 00:00:17,408
That allows us to
6
00:00:17,664 --> 00:00:20,224
Easily added functionality to future and
7
00:00:20,736 --> 00:00:22,528
That we might add to our game
8
00:00:22,784 --> 00:00:24,832
And so what we're going to be doing this for going to you
9
00:00:25,088 --> 00:00:26,624
A technique known as
10
00:00:26,880 --> 00:00:27,648
Composition
11
00:00:28,160 --> 00:00:32,512
Composition is essentially what we've been doing with the native good all
12
00:00:33,024 --> 00:00:34,304
We take us
13
00:00:34,560 --> 00:00:37,376
Of a bunch of different types of nose
14
00:00:37,632 --> 00:00:39,168
So for instance if I go to my place
15
00:00:39,680 --> 00:00:41,728
We have a bunch of different types of notes
16
00:00:42,496 --> 00:00:44,288
And all of these notes
17
00:00:44,800 --> 00:00:47,104
I have distinct functionality
18
00:00:47,360 --> 00:00:48,384
What together
19
00:00:48,640 --> 00:00:49,920
They composed
20
00:00:50,432 --> 00:00:51,200
The player
21
00:00:52,480 --> 00:00:54,784
And so we're going to be doing something similar
22
00:00:55,552 --> 00:00:58,112
With our own notes and what we're going to do
23
00:00:58,368 --> 00:00:59,136
Is were going
24
00:00:59,392 --> 00:00:59,904
Create a
25
00:01:00,123 --> 00:01:02,363
Subtitled by
online-courses.club
We compress knowledge for you!
26
00:01:02,364 --> 00:01:01,696
Vial drop composed
27
00:01:02,208 --> 00:01:05,280
And the vile drug component will be able to listen for
28
00:01:05,536 --> 00:01:06,560
When the anime dies
29
00:01:06,816 --> 00:01:08,352
And then spawn a Vial at
30
00:01:09,632 --> 00:01:10,912
If a certain
31
00:01:11,168 --> 00:01:11,936
Threshold is met
32
00:01:12,192 --> 00:01:15,008
But before we do that we want to implement
33
00:01:15,264 --> 00:01:16,800
Health component first
34
00:01:17,056 --> 00:01:18,848
Set the volume drop comp
35
00:01:19,104 --> 00:01:19,616
You can listen for
36
00:01:19,872 --> 00:01:23,968
So let's go out and create a health component and that will allow us to create
37
00:01:24,224 --> 00:01:26,016
The concept of health as well
38
00:01:26,528 --> 00:01:28,576
So let's create a new note control
39
00:01:29,088 --> 00:01:30,112
Click on other node
40
00:01:30,368 --> 00:01:32,160
Make this note a
41
00:01:32,416 --> 00:01:33,440
Play Oldham
42
00:01:33,696 --> 00:01:34,976
Let's call this health
43
00:01:35,232 --> 00:01:35,744
Component
44
00:01:38,304 --> 00:01:38,816
What's 8
45
00:01:39,328 --> 00:01:42,400
Save it into seems and then let's create a new folder
46
00:01:42,656 --> 00:01:43,680
Call the component
47
00:01:44,704 --> 00:01:45,472
And let's see
48
00:01:45,728 --> 00:01:47,520
The health component in there
49
00:01:47,776 --> 00:01:49,056
Search go ahead in Addiscombe
50
00:01:49,312 --> 00:01:51,616
And the default settings are
51
00:01:52,128 --> 00:01:54,432
I'm going to add an export variable at the top
52
00:01:54,944 --> 00:01:55,968
At export
53
00:01:56,480 --> 00:01:56,992
Bar
54
00:01:57,248 --> 00:01:59,296
Max underscore health
55
00:02:01,600 --> 00:02:05,184
And we can just said it we can initialise it to something like
56
00:02:05,696 --> 00:02:09,280
So now you can see that our health component has a Max health property
57
00:02:09,536 --> 00:02:11,072
That we can add it through the inspect
58
00:02:11,840 --> 00:02:14,912
Ok so what kind of functionality does a health component
59
00:02:15,424 --> 00:02:19,008
Really clear out of these functions and we're going to write a new function
60
00:02:19,520 --> 00:02:20,032
Funk
61
00:02:20,288 --> 00:02:20,800
Damage
62
00:02:21,056 --> 00:02:25,408
And then we're going to take a damage parameter which is going to be a Flo
63
00:02:26,688 --> 00:02:28,224
And we need to subtract
64
00:02:28,480 --> 00:02:29,504
The current health
65
00:02:29,760 --> 00:02:31,296
Based on the damage that's coming
66
00:02:31,808 --> 00:02:33,344
So let's just right past
67
00:02:33,856 --> 00:02:35,136
An up blow
68
00:02:35,648 --> 00:02:37,696
The max health export variable
69
00:02:37,952 --> 00:02:40,512
Let's do another variable called current
70
00:02:41,280 --> 00:02:44,864
Can we actually do need that ready method so let's go ahead and and that ready
71
00:02:45,120 --> 00:02:45,632
The back in
72
00:02:46,144 --> 00:02:46,656
So far
73
00:02:47,168 --> 00:02:48,192
Underscore Reading
74
00:02:48,448 --> 00:02:51,776
Really just say current health is equal to Max health
75
00:02:52,544 --> 00:02:53,312
Henry
76
00:02:54,336 --> 00:02:55,104
Perfect
77
00:02:55,360 --> 00:02:56,640
So when we damage
78
00:02:56,896 --> 00:02:57,920
The Entity
79
00:02:58,176 --> 00:02:58,944
We need to
80
00:02:59,200 --> 00:02:59,968
Current health
81
00:03:00,224 --> 00:03:02,528
And subtract with Myers
82
00:03:02,784 --> 00:03:03,296
The damage
83
00:03:03,552 --> 00:03:04,064
Now
84
00:03:04,320 --> 00:03:06,880
We actually don't want to help to be negative
85
00:03:07,392 --> 00:03:09,952
A more appropriate way to do this
86
00:03:10,208 --> 00:03:11,744
Might be something like
87
00:03:12,256 --> 00:03:13,024
Current
88
00:03:14,048 --> 00:03:14,560
Equal
89
00:03:15,328 --> 00:03:15,840
Max
90
00:03:17,120 --> 00:03:17,632
Current health
91
00:03:17,888 --> 00:03:18,912
-10
92
00:03:19,424 --> 00:03:20,192
And 0
93
00:03:20,448 --> 00:03:22,752
So Max takes the maximum
94
00:03:23,008 --> 00:03:25,056
Value of the two supplies
95
00:03:25,568 --> 00:03:28,896
And this case if we ever end up with a negative
96
00:03:30,176 --> 00:03:30,944
When we take
97
00:03:31,200 --> 00:03:33,504
The damage being passed in away from the current
98
00:03:34,016 --> 00:03:35,552
The maximum value becomes zero
99
00:03:36,064 --> 00:03:39,904
This is essentially in forcing that we never dropped below 0 for a curry
100
00:03:40,416 --> 00:03:41,952
Then we can do as we can
101
00:03:42,208 --> 00:03:42,720
F
102
00:03:42,976 --> 00:03:43,744
Current health
103
00:03:44,000 --> 00:03:45,024
Is equal to Z
104
00:03:45,536 --> 00:03:46,304
Then what we need to
105
00:03:46,816 --> 00:03:47,584
We need to die
106
00:03:47,840 --> 00:03:48,352
However
107
00:03:48,864 --> 00:03:50,656
We don't really have anything
108
00:03:50,912 --> 00:03:51,936
Hear that control
109
00:03:52,192 --> 00:03:57,312
The death so what we're going to do is we're going to create a custom signal above the export variable
110
00:03:57,568 --> 00:03:58,336
So signal
111
00:03:58,592 --> 00:03:59,104
Dad
112
00:03:59,360 --> 00:04:01,152
And then when our current health equals
113
00:04:01,408 --> 00:04:02,688
What we can do as we can do
114
00:04:02,944 --> 00:04:04,224
Died
115
00:04:04,736 --> 00:04:09,600
Just like some so again this is just going to notify anything at listening that we've died
116
00:04:10,368 --> 00:04:11,648
And you talking to
117
00:04:11,904 --> 00:04:13,184
We're going to use
118
00:04:13,696 --> 00:04:14,720
Start q
119
00:04:15,744 --> 00:04:16,768
So what is this
120
00:04:17,280 --> 00:04:18,047
It's a little bit
121
00:04:18,303 --> 00:04:19,327
Tricky to explain
122
00:04:19,839 --> 00:04:21,631
Owner is the note
123
00:04:21,887 --> 00:04:23,679
That constitutes the route
124
00:04:23,935 --> 00:04:26,495
Are the scene that this notice
125
00:04:27,263 --> 00:04:27,775
So
126
00:04:28,031 --> 00:04:31,103
In this scene in my help component seen my owner is Noor
127
00:04:31,359 --> 00:04:32,383
My owner is no
128
00:04:32,639 --> 00:04:36,479
Why because there's health component is the root of it scene
129
00:04:36,735 --> 00:04:39,295
So it doesn't have an owner there's nothing at all
130
00:04:39,551 --> 00:04:43,135
If I were to add what's a Sprite 2D as a child
131
00:04:43,391 --> 00:04:44,159
This spray
132
00:04:44,415 --> 00:04:45,439
2DS owner
133
00:04:45,695 --> 00:04:46,463
Is the help
134
00:04:47,231 --> 00:04:47,743
Right
135
00:04:48,255 --> 00:04:49,279
Let's take a look at it
136
00:04:49,791 --> 00:04:50,303
My player
137
00:04:50,559 --> 00:04:52,351
Buy players area2d
138
00:04:52,607 --> 00:04:54,143
Has an owner that is equal to
139
00:04:54,655 --> 00:04:55,423
The player
140
00:04:55,679 --> 00:04:56,703
Does not have an hour
141
00:04:57,471 --> 00:05:01,823
So when we go to a basic enemy so I'm going to control shift go and open up the basic anyway
142
00:05:02,335 --> 00:05:03,615
When I instantiated
143
00:05:04,127 --> 00:05:08,223
The health component which you should do this as well so go ahead and stay and she a health camp
144
00:05:08,479 --> 00:05:09,503
Space Academy
145
00:05:09,759 --> 00:05:11,295
With ctrl shift a
146
00:05:11,551 --> 00:05:12,319
Lights on
147
00:05:12,575 --> 00:05:14,367
This health component now has an owner
148
00:05:14,623 --> 00:05:15,391
What is basically
149
00:05:15,647 --> 00:05:17,183
So we'll look at that script
150
00:05:17,695 --> 00:05:20,255
What is doing moana Q3
151
00:05:20,767 --> 00:05:22,047
Ordered IQ free
152
00:05:22,303 --> 00:05:22,815
Breeze
153
00:05:23,071 --> 00:05:23,839
The scene
154
00:05:24,095 --> 00:05:25,119
But this helps
155
00:05:25,375 --> 00:05:25,887
Belong
156
00:05:26,399 --> 00:05:28,959
That will probably move this at some point
157
00:05:29,471 --> 00:05:30,239
Out of this
158
00:05:30,495 --> 00:05:33,311
Will it make sense for an hour to put this functionality in the
159
00:05:33,567 --> 00:05:34,079
Component
160
00:05:34,591 --> 00:05:39,455
So let's go to a basic anime Script so open up the basic anime scene and click on the Script icon
161
00:05:39,711 --> 00:05:41,759
So we have this on area enter
162
00:05:42,271 --> 00:05:45,855
Instead of calling q-free we actually went to apply damage to the
163
00:05:46,623 --> 00:05:50,975
So let's go up blower max speed and Let's Get It On red
164
00:05:51,487 --> 00:05:52,255
Reference
165
00:05:52,767 --> 00:05:54,303
To the health care
166
00:05:55,583 --> 00:05:57,375
So I'm ready for health compare
167
00:05:57,887 --> 00:05:59,167
Is equal to dollar sign
168
00:06:00,959 --> 00:06:04,799
And what we can do if we can go to your health component script again
169
00:06:05,055 --> 00:06:07,103
And underneath the note we can write
170
00:06:07,359 --> 00:06:08,895
Class underscore name
171
00:06:09,407 --> 00:06:09,919
Health
172
00:06:10,431 --> 00:06:10,943
Combine
173
00:06:11,967 --> 00:06:13,759
And this will allow us to cast
174
00:06:14,015 --> 00:06:15,295
Things to the health
175
00:06:15,551 --> 00:06:16,063
Component
176
00:06:16,319 --> 00:06:19,647
Type which will give us the Intelligence we need
177
00:06:19,903 --> 00:06:21,695
Order code suggestions we
178
00:06:21,951 --> 00:06:24,255
2 for example use damage ankle
179
00:06:24,511 --> 00:06:25,279
To the Dead Sea
180
00:06:26,047 --> 00:06:28,351
Go back to my basic enemies
181
00:06:28,863 --> 00:06:31,423
And I'm going to type this health component as a type of
182
00:06:31,679 --> 00:06:32,447
Health compare
183
00:06:32,959 --> 00:06:37,311
Perfect and so now in the area entered I'm just going to do something very
184
00:06:37,823 --> 00:06:38,591
Health
185
00:06:38,847 --> 00:06:39,359
Start
186
00:06:39,615 --> 00:06:40,127
Damage
187
00:06:43,711 --> 00:06:45,759
And let's just go ahead and put 100 in
188
00:06:46,271 --> 00:06:50,623
Remove the Q3 from the basic anime and using the health component
189
00:06:51,903 --> 00:06:53,951
No obviously we're not getting any damage
190
00:06:54,207 --> 00:06:54,719
From
191
00:06:55,231 --> 00:06:55,743
The other
192
00:06:55,999 --> 00:06:56,511
Area
193
00:06:56,767 --> 00:06:57,535
And that's fine
194
00:06:57,791 --> 00:07:01,119
We won't work on abilities transferring damage in
195
00:07:01,375 --> 00:07:01,887
Future
196
00:07:02,399 --> 00:07:05,471
Ok so we should basically see no functional chair
197
00:07:05,983 --> 00:07:07,007
When we're on the
198
00:07:07,263 --> 00:07:08,031
So what's going on
199
00:07:09,567 --> 00:07:12,895
Ok so the sword appears and Still Kill
200
00:07:13,407 --> 00:07:13,919
The rat
201
00:07:14,687 --> 00:07:16,223
Ok so that's looking great
202
00:07:16,479 --> 00:07:19,551
Warning me about the local function parameter
203
00:07:19,807 --> 00:07:21,343
Damage shadowing and
204
00:07:22,623 --> 00:07:23,903
The problem is that I have
205
00:07:24,159 --> 00:07:27,743
A function called damage and the parameter is called damage as well
206
00:07:28,255 --> 00:07:33,119
And that can be a problem because if I were a cold damage again in this function
207
00:07:33,631 --> 00:07:36,703
It might be ambiguous as to what I'm afraid
208
00:07:37,215 --> 00:07:40,543
So I'm going to do instead as I'm going to rename this damage
209
00:07:40,799 --> 00:07:43,871
Parameter to damage amount so if you highlight this damage
210
00:07:44,127 --> 00:07:45,663
And then press control d
211
00:07:45,919 --> 00:07:48,223
That will highlight the second instance of damage that
212
00:07:48,479 --> 00:07:51,039
Using here that I was going to write damage underscore
213
00:07:52,319 --> 00:07:53,343
And that should be just
214
00:07:54,111 --> 00:07:56,159
Ok so we've got the health component can figure
215
00:07:56,415 --> 00:08:01,279
And obviously we can go to our enemy here and we can change the amount of health
216
00:08:01,535 --> 00:08:03,839
That the enemy has just threw the editor here
217
00:08:04,095 --> 00:08:04,863
Incel
218
00:08:05,119 --> 00:08:06,399
Windows health component build
219
00:08:06,655 --> 00:08:11,007
We can now add this health component to any entity we want to have
220
00:08:11,263 --> 00:08:13,311
And it becomes a nice reusable
221
00:08:13,567 --> 00:08:14,335
Piece of coal
222
00:08:14,847 --> 00:08:15,871
This is composite
223
00:08:16,127 --> 00:08:17,663
We're going to use this whole component
224
00:08:17,919 --> 00:08:18,943
All over the place
225
00:08:19,199 --> 00:08:20,479
Broad kinds of purpose
226
00:08:20,735 --> 00:08:23,551
And we don't need to keep writing the same code over now
227
00:08:24,063 --> 00:08:28,159
So what the hell come on built let's ride a vile drop components
228
00:08:28,415 --> 00:08:29,695
Let's head control m
229
00:08:30,719 --> 00:08:33,023
Same deal make this a
230
00:08:33,791 --> 00:08:34,815
Basic notes
231
00:08:35,327 --> 00:08:36,351
Cotton voile
232
00:08:36,607 --> 00:08:37,119
Drop
233
00:08:37,375 --> 00:08:37,887
Compound
234
00:08:38,399 --> 00:08:39,679
So let's go ahead and save
235
00:08:39,935 --> 00:08:42,495
And I just can't Vale drop and it will put it right next to the
236
00:08:44,543 --> 00:08:45,823
Let's go ahead and Addiscombe
237
00:08:46,847 --> 00:08:48,639
What we're going to do this time
238
00:08:49,151 --> 00:08:50,687
Is we're going to
239
00:08:50,943 --> 00:08:52,479
We're going to turn off the 10
240
00:08:52,991 --> 00:08:56,831
So we don't want to have the ready method and process method to find first anymore
241
00:08:57,087 --> 00:09:00,159
We have a good grasp of scripting sword just going to cry
242
00:09:00,415 --> 00:09:02,719
Andover going to get is the extend no
243
00:09:02,975 --> 00:09:03,487
Witches
244
00:09:03,743 --> 00:09:04,255
Perfectly
245
00:09:04,767 --> 00:09:10,911
The veiled wrap component what do we need well we need a reference to the vile seem so
246
00:09:11,167 --> 00:09:12,703
Go ahead and right at export
247
00:09:13,727 --> 00:09:14,239
Via
248
00:09:14,751 --> 00:09:16,031
Underscores theme
249
00:09:16,543 --> 00:09:17,567
That's going to be of time
250
00:09:17,823 --> 00:09:18,591
Vaccine
251
00:09:19,359 --> 00:09:21,663
Let's override the ready function
252
00:09:21,919 --> 00:09:23,967
And what are we going to do in this
253
00:09:24,223 --> 00:09:24,735
Function
254
00:09:24,991 --> 00:09:26,783
Well we actually need a reference
255
00:09:27,039 --> 00:09:27,807
To the health camp
256
00:09:28,063 --> 00:09:28,831
As well
257
00:09:29,087 --> 00:09:32,927
Solicitors Right pass in our ready method here
258
00:09:33,183 --> 00:09:34,463
Just read it doesn't error
259
00:09:35,231 --> 00:09:37,023
What's create another export variable
260
00:09:37,535 --> 00:09:38,559
I'm going to create
261
00:09:38,815 --> 00:09:40,095
Health composed
262
00:09:40,863 --> 00:09:41,375
No
263
00:09:41,631 --> 00:09:42,399
Just like so
264
00:09:42,655 --> 00:09:44,447
So what that's going to do is that going to Louth
265
00:09:44,703 --> 00:09:45,215
Supply
266
00:09:45,471 --> 00:09:47,775
The health component path in the edge
267
00:09:48,287 --> 00:09:50,079
And then I'm ready what we can do
268
00:09:50,591 --> 00:09:51,359
Is we can say
269
00:09:51,615 --> 00:09:52,639
Health component
270
00:09:54,175 --> 00:09:54,687
Health
271
00:09:54,943 --> 00:09:55,455
Component
272
00:09:55,711 --> 00:09:56,991
Animal parenthesized
273
00:09:57,247 --> 00:09:59,551
Where is a guide which is the Sydney
274
00:09:59,807 --> 00:10:00,460
Dartconnect
275
00:10:00,461 --> 00:10:02,760
Subtitled by
online-courses.club
We compress knowledge for you!
276
00:10:02,761 --> 00:10:01,855
On
277
00:10:02,111 --> 00:10:02,623
Dad
278
00:10:02,879 --> 00:10:05,183
So it's that simple and then we're going to go
279
00:10:05,695 --> 00:10:06,463
Endive
280
00:10:07,487 --> 00:10:10,815
And what we want to do on death well we want to do a check
281
00:10:11,327 --> 00:10:13,631
Vale seen is equal to null
282
00:10:13,887 --> 00:10:15,679
Then we're just going to return out of there
283
00:10:16,191 --> 00:10:16,703
Because We Can
284
00:10:17,215 --> 00:10:18,495
Device is not defined
285
00:10:18,751 --> 00:10:22,335
So what are we going to do we want to spawn the vile at the position of
286
00:10:22,847 --> 00:10:23,359
Enemy
287
00:10:23,615 --> 00:10:24,127
And
288
00:10:24,383 --> 00:10:30,271
The veil drop component is going to be another note alongside the health component so we can use the owner again
289
00:10:30,783 --> 00:10:31,807
To grab the
290
00:10:32,063 --> 00:10:33,343
Now this is a little
291
00:10:33,599 --> 00:10:35,647
Unsafe because we're not guaranteed
292
00:10:35,903 --> 00:10:37,695
The owner is going to be a note today
293
00:10:38,207 --> 00:10:39,999
So we could write a check we can say
294
00:10:41,023 --> 00:10:41,535
Moana
295
00:10:41,791 --> 00:10:42,559
Is not
296
00:10:43,327 --> 00:10:44,095
No time to die
297
00:10:44,863 --> 00:10:45,887
Then we can return
298
00:10:46,655 --> 00:10:52,799
And I've got this order of the is not reverse the little bit not has to come first so if not owner
299
00:10:53,055 --> 00:10:54,335
Is no to die
300
00:10:54,591 --> 00:10:59,711
Then we're going to return which means that if we make it past that then our owner is entitled to
301
00:10:59,967 --> 00:11:02,527
And so what I can do is I can save our
302
00:11:02,783 --> 00:11:03,807
Spawn position
303
00:11:04,319 --> 00:11:04,831
Is eagle
304
00:11:05,087 --> 00:11:05,599
Moana
305
00:11:05,855 --> 00:11:07,135
Parentheses first
306
00:11:07,391 --> 00:11:08,159
Moana
307
00:11:08,671 --> 00:11:09,951
As notary
308
00:11:10,207 --> 00:11:11,487
Dart global
309
00:11:11,999 --> 00:11:13,791
Perfect select response position
310
00:11:14,047 --> 00:11:15,071
Then we're going to take
311
00:11:15,327 --> 00:11:16,863
The vile seem so we're gonna
312
00:11:17,119 --> 00:11:19,167
Instantiate that's all say vile
313
00:11:19,423 --> 00:11:20,959
Incidence is equal to
314
00:11:21,471 --> 00:11:24,031
Vial seen.in stands
315
00:11:24,287 --> 00:11:25,311
Again we should
316
00:11:25,567 --> 00:11:27,871
Instantiate as a node to use
317
00:11:28,127 --> 00:11:28,639
We get the
318
00:11:28,895 --> 00:11:30,175
Proper intelligence
319
00:11:30,431 --> 00:11:32,479
Animal going to take the owner
320
00:11:32,735 --> 00:11:33,759
Get pair
321
00:11:34,271 --> 00:11:35,295
So we're going to
322
00:11:35,551 --> 00:11:36,575
Princess adda
323
00:11:36,831 --> 00:11:37,599
As a child
324
00:11:38,111 --> 00:11:39,391
To the parent of the owner
325
00:11:39,647 --> 00:11:40,927
Get parent and Child
326
00:11:41,439 --> 00:11:42,207
Violin strings
327
00:11:43,231 --> 00:11:43,999
And I'm going to say
328
00:11:44,255 --> 00:11:46,303
While instance global position
329
00:11:47,071 --> 00:11:48,351
Sequel to spawn
330
00:11:48,863 --> 00:11:49,375
Position
331
00:11:49,631 --> 00:11:51,167
Perfect solicitor are basically
332
00:11:51,423 --> 00:11:53,215
And let instantiation
333
00:11:53,471 --> 00:11:54,751
A child seen underneath
334
00:11:55,007 --> 00:11:57,823
And we're going to instantiate the file drop company
335
00:11:58,079 --> 00:12:01,663
And we're going to put it right next to the health component in the tree here
336
00:12:01,919 --> 00:12:04,735
And now let's sign the health compare
337
00:12:04,991 --> 00:12:06,527
In the health component property
338
00:12:06,783 --> 00:12:09,343
But we're not going to assign the vile scene
339
00:12:09,855 --> 00:12:13,695
We actually want to assign the vile scene within the veil drop component itself
340
00:12:13,951 --> 00:12:15,743
So open up the volume drop compose
341
00:12:16,767 --> 00:12:18,303
Search your filesystem
342
00:12:18,559 --> 00:12:19,071
4
343
00:12:19,327 --> 00:12:20,351
Experience vile
344
00:12:20,607 --> 00:12:22,911
And go ahead and drag it over to the vile
345
00:12:23,679 --> 00:12:25,471
So now we go back to our basic enemy
346
00:12:25,727 --> 00:12:27,519
You can see when I hover over the vile
347
00:12:27,775 --> 00:12:28,287
Component
348
00:12:28,543 --> 00:12:29,567
That's vile scene
349
00:12:30,847 --> 00:12:32,639
So now whenever we instantiate the valve
350
00:12:32,895 --> 00:12:36,735
Component the only thing that will need to be said is the health component which will 0.2
351
00:12:36,991 --> 00:12:37,759
The local
352
00:12:38,015 --> 00:12:39,039
Self composed
353
00:12:39,295 --> 00:12:41,087
Ok let's go back to our main
354
00:12:41,343 --> 00:12:44,671
Delete all of these experiences while so holdship
355
00:12:44,927 --> 00:12:45,439
And click
356
00:12:45,695 --> 00:12:46,975
The first one in last one
357
00:12:47,487 --> 00:12:49,535
Delete all of them by pressing delete
358
00:12:49,791 --> 00:12:52,095
And then let's go ahead and Run the game
359
00:12:52,607 --> 00:12:54,911
And so as these things die they should drop vials
360
00:12:56,959 --> 00:12:57,471
Perfect
361
00:12:57,983 --> 00:12:58,751
So there's one Vial
362
00:12:59,007 --> 00:12:59,519
Now
363
00:12:59,775 --> 00:13:01,823
We're getting a couple of hours here
364
00:13:02,079 --> 00:13:02,591
Ok
365
00:13:02,847 --> 00:13:04,127
So here is another quote
366
00:13:04,383 --> 00:13:04,895
Adele
367
00:13:05,151 --> 00:13:10,015
If you look at your errors you'll see can't change state while flushing
368
00:13:10,527 --> 00:13:11,039
Queries
369
00:13:11,295 --> 00:13:12,319
And this is because
370
00:13:12,575 --> 00:13:15,135
We're trying to freeze something that is in the middle
371
00:13:15,647 --> 00:13:16,927
Handling collisions
372
00:13:17,183 --> 00:13:18,719
That's just a good ol' Cork
373
00:13:18,975 --> 00:13:20,511
I'm not sure exactly why
374
00:13:20,767 --> 00:13:23,327
What is the case but the way that we get around that area
375
00:13:23,583 --> 00:13:24,607
Is we actually need to use
376
00:13:24,863 --> 00:13:25,375
Call
377
00:13:25,631 --> 00:13:26,143
Deferred
378
00:13:26,399 --> 00:13:30,751
And what deferred calling does is it wait until the idle frame to call
379
00:13:32,031 --> 00:13:33,567
Sophie got oral health component here
380
00:13:33,823 --> 00:13:34,591
Are we going to do
381
00:13:34,847 --> 00:13:36,639
Is we are going to create a new function
382
00:13:36,895 --> 00:13:39,711
Card check underscore death in our health and
383
00:13:39,967 --> 00:13:44,063
We're going to take this if current health is a good as your work I take that out and
384
00:13:44,575 --> 00:13:46,111
Underneath that checked
385
00:13:46,623 --> 00:13:48,159
Does the check that function body
386
00:13:48,415 --> 00:13:50,975
And any here what we're gonna do we're gonna use
387
00:13:51,231 --> 00:13:51,999
Callable
388
00:13:52,255 --> 00:13:53,535
So capital city
389
00:13:53,791 --> 00:13:54,303
This is 8
390
00:13:54,559 --> 00:13:55,071
Callable
391
00:13:55,327 --> 00:14:01,471
And then in parentheses were going to put in a reference to check DAF now your autocomplete is
392
00:14:01,727 --> 00:14:03,263
I want to automatically call it
393
00:14:03,519 --> 00:14:05,823
Why using parentheses we don't want that
394
00:14:06,079 --> 00:14:07,615
So remove those parentheses
395
00:14:07,871 --> 00:14:11,455
They should just be passing a reference to the function in the collarbone
396
00:14:11,967 --> 00:14:13,247
And then we can do
397
00:14:13,503 --> 00:14:14,271
Call deferred
398
00:14:14,783 --> 00:14:17,087
So that's going to do that going to take this function
399
00:14:17,343 --> 00:14:19,135
And then call it on the next I don't
400
00:14:19,647 --> 00:14:20,159
And then
401
00:14:20,415 --> 00:14:23,743
We're going to do the check that function at that point and then we can
402
00:14:24,255 --> 00:14:27,071
Handle all the stuff for handling so it's going round the game again
403
00:14:27,327 --> 00:14:29,119
That should no longer be
404
00:14:29,887 --> 00:14:31,679
And we can see that vials were being spun
405
00:14:32,191 --> 00:14:33,727
And I can go ahead and pick them up
406
00:14:33,983 --> 00:14:38,847
So one final thing to do before we wrap up this lesson which I know is a little bit longer than the other
407
00:14:39,103 --> 00:14:41,407
Is Rihanna add a drop percentage
408
00:14:41,663 --> 00:14:42,687
Answer to the vile
409
00:14:43,199 --> 00:14:46,271
Insole let's go ahead and go back to eval component script
410
00:14:46,783 --> 00:14:48,319
As the first export variable
411
00:14:48,575 --> 00:14:51,391
What's actually reorder some things let's move the pack scene
412
00:14:51,647 --> 00:14:52,927
Blow everything so
413
00:14:53,439 --> 00:14:57,279
Use alt and down on your keyboard to move that line down
414
00:14:57,791 --> 00:15:01,119
And then the first export is going to be
415
00:15:01,375 --> 00:15:02,143
Port Vale
416
00:15:04,959 --> 00:15:05,471
Flower
417
00:15:05,727 --> 00:15:06,239
No
418
00:15:06,495 --> 00:15:11,871
Are we actually do instead of just a plain old export as we can do export underscore range
419
00:15:12,383 --> 00:15:14,175
And then we can in parentheses
420
00:15:14,687 --> 00:15:15,711
Define what the range
421
00:15:15,967 --> 00:15:18,015
So we can say 0 as the men
422
00:15:18,271 --> 00:15:19,551
And one of the max
423
00:15:19,807 --> 00:15:22,623
So if we go to avail drop component over on the left
424
00:15:22,879 --> 00:15:25,951
We can see a drop percent in it cannot exceed 1
425
00:15:26,207 --> 00:15:27,743
And it cannot go below zero
426
00:15:28,255 --> 00:15:33,631
So this is nice because it doesn't make sense to have a more than 100% or less than 0%
427
00:15:34,143 --> 00:15:34,655
Strawberry
428
00:15:34,911 --> 00:15:38,495
Perfect an elastic that we're going to do with the Val drop is we're just going to say
429
00:15:38,751 --> 00:15:40,031
Initially to
430
00:15:40,287 --> 00:15:41,823
What's a .5
431
00:15:42,335 --> 00:15:45,151
So I'll have a 50% drop rate by The Fall
432
00:15:45,663 --> 00:15:46,943
That will be configurable
433
00:15:47,199 --> 00:15:52,063
And the reason that you might want to set a default variable in your exports is because if I go over 2
434
00:15:52,319 --> 00:15:53,855
Just represent in I
435
00:15:54,111 --> 00:15:54,623
Dragon
436
00:15:54,879 --> 00:15:57,439
You can see that this little arrow appears
437
00:15:57,695 --> 00:15:58,719
When it's not
438
00:15:58,975 --> 00:16:01,023
When the values are equal to its default
439
00:16:01,535 --> 00:16:04,863
And that's nice because now I can just click the arrow to reset it
440
00:16:05,119 --> 00:16:06,655
To what I've got hardcore
441
00:16:07,167 --> 00:16:07,935
Industry
442
00:16:08,447 --> 00:16:12,287
So if you want to just provide some sensible defaults for anything that your export
443
00:16:12,543 --> 00:16:13,823
That's all
444
00:16:14,079 --> 00:16:14,847
Hindi to do
445
00:16:15,103 --> 00:16:18,175
So now we need to take into account that drop
446
00:16:18,431 --> 00:16:18,943
Percent
447
00:16:19,199 --> 00:16:19,711
Right
448
00:16:19,967 --> 00:16:20,479
So
449
00:16:20,735 --> 00:16:23,551
What we can do it simply is we can just say if
450
00:16:23,807 --> 00:16:24,319
Ran
451
00:16:25,343 --> 00:16:27,135
Surround f Returns
452
00:16:27,391 --> 00:16:32,767
Every you can control click into things by the way so I hold ctrl and click in taranto
453
00:16:33,023 --> 00:16:35,327
That will take me right to the documentation for
454
00:16:36,095 --> 00:16:36,863
And that
455
00:16:37,119 --> 00:16:40,447
Says it return the floating-point value between 0 and 1
456
00:16:40,959 --> 00:16:41,471
So
457
00:16:41,727 --> 00:16:43,263
It's going to be very
458
00:16:43,775 --> 00:16:44,799
To do what we need to do
459
00:16:45,055 --> 00:16:48,383
We can just say if Randolph is a functions on Vulcan
460
00:16:48,639 --> 00:16:50,175
Is less than or equal to
461
00:16:50,431 --> 00:16:51,711
Drop percent
462
00:16:53,503 --> 00:16:57,855
Actually it's not do that let's say if friend of is greater than 8%
463
00:16:58,367 --> 00:16:58,879
Return
464
00:16:59,391 --> 00:17:00,159
So basically
465
00:17:00,671 --> 00:17:05,023
F r and F is not within the range of 0 to drop
466
00:17:05,279 --> 00:17:05,791
Percent
467
00:17:06,047 --> 00:17:08,095
Then we're just going to return outlet
468
00:17:08,607 --> 00:17:14,751
Ok so now for you run the game in test that we should see that roughly half the enemies drop vials when they die
469
00:17:15,263 --> 00:17:16,031
So that one drop
470
00:17:17,055 --> 00:17:17,823
That one day
471
00:17:18,591 --> 00:17:19,103
That one
472
00:17:19,615 --> 00:17:20,127
That one
473
00:17:20,383 --> 00:17:21,151
One of them
474
00:17:21,663 --> 00:17:23,455
So it looks to be working
475
00:17:23,967 --> 00:17:30,111
Ok so that was an introduction to components we've now got a health component and a vile drop component that we can use toucan
476
00:17:30,367 --> 00:17:32,159
Play your game as we continue
477
00:17:32,415 --> 00:17:33,183
Into the future
31138
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.