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:02,560
Are you ready to make the sword kill some enemies
2
00:00:02,816 --> 00:00:04,864
Let's get into it that sounds fun
3
00:00:05,120 --> 00:00:08,448
Alright so I'm going to open up one of my enemies
4
00:00:08,704 --> 00:00:10,496
Is here or dizzy and my seeing red
5
00:00:11,008 --> 00:00:11,520
And
6
00:00:11,776 --> 00:00:13,056
I'm going to go out
7
00:00:13,312 --> 00:00:14,336
Add a
8
00:00:14,848 --> 00:00:15,360
Area
9
00:00:16,640 --> 00:00:18,688
Area2d note
10
00:00:18,944 --> 00:00:22,016
Is is it essentially a way of detecting collisions
11
00:00:22,272 --> 00:00:23,296
They are essentially
12
00:00:23,552 --> 00:00:24,064
Trigger's
13
00:00:24,320 --> 00:00:25,856
So you can imagine that
14
00:00:26,112 --> 00:00:27,648
Kind of two different types of curls
15
00:00:28,160 --> 00:00:30,208
Is the types of collisions that will make
16
00:00:30,464 --> 00:00:35,072
Character stop when they hit something but then there is the type of collisions like hitbox
17
00:00:35,328 --> 00:00:38,144
Which are basically just detections of weather
18
00:00:38,400 --> 00:00:38,912
To take down
19
00:00:39,680 --> 00:00:41,984
Very rarely and James does it actually
20
00:00:42,240 --> 00:00:42,752
When a fact
21
00:00:43,008 --> 00:00:44,544
On your characters ability
22
00:00:44,800 --> 00:00:45,312
To move
23
00:00:45,568 --> 00:00:46,080
So
24
00:00:46,336 --> 00:00:49,920
Rebecca going to be setting up this area to use which are going to act as Trigger's
25
00:00:50,176 --> 00:00:51,200
That we can listen to
26
00:00:51,456 --> 00:00:52,480
So that we know when
27
00:00:52,736 --> 00:00:54,272
Destroy the enemy or deals
28
00:00:54,784 --> 00:00:56,576
Do the player and so on and so forth
29
00:00:57,088 --> 00:00:58,368
So I've got my area today
30
00:00:58,624 --> 00:01:00,653
We need to match like the character body 2
31
00:01:00,655 --> 00:01:03,003
Subtitled by
online-courses.club
We compress knowledge for you!
32
00:01:03,004 --> 00:01:02,464
Add a collision
33
00:01:02,720 --> 00:01:03,232
2D
34
00:01:03,488 --> 00:01:04,256
The child 2
35
00:01:04,512 --> 00:01:07,584
And what I'm going to do as I'm going to create a new circle
36
00:01:08,096 --> 00:01:09,120
In that
37
00:01:10,144 --> 00:01:12,448
And it's generally a good idea
38
00:01:12,704 --> 00:01:13,472
To make your
39
00:01:13,984 --> 00:01:15,520
Hitbox and hurt back
40
00:01:16,032 --> 00:01:16,544
Sizes
41
00:01:17,056 --> 00:01:18,592
Biased in the players favour
42
00:01:18,848 --> 00:01:21,920
So that means when you're creating a heart box for an enemy
43
00:01:22,432 --> 00:01:24,480
You want to make the heart box larger
44
00:01:24,736 --> 00:01:25,248
Then
45
00:01:25,504 --> 00:01:26,272
The enemies
46
00:01:26,784 --> 00:01:27,552
So I'm going to
47
00:01:28,576 --> 00:01:29,088
12
48
00:01:29,600 --> 00:01:30,368
I'm going to you
49
00:01:30,880 --> 00:01:32,672
The move to all by hitting w
50
00:01:32,928 --> 00:01:35,232
I'm just going to move it up until it's about Sam
51
00:01:35,744 --> 00:01:38,304
And I end up with a position of -5
52
00:01:38,560 --> 00:01:39,072
In the
53
00:01:39,584 --> 00:01:42,656
You can see how this area is much bigger than the Vision
54
00:01:42,912 --> 00:01:45,728
And that's actually a good thing because we want to
55
00:01:45,984 --> 00:01:46,496
To be
56
00:01:46,752 --> 00:01:50,080
For giving to the player to some extent so it the game field
57
00:01:50,336 --> 00:01:51,872
Really fun and
58
00:01:52,128 --> 00:01:54,432
Smooth and not super Pig
59
00:01:54,944 --> 00:01:56,480
And I'm going to move this area to d
60
00:01:56,736 --> 00:01:57,760
To the first
61
00:01:58,016 --> 00:01:59,040
Child
62
00:01:59,296 --> 00:02:00,320
The character
63
00:02:00,576 --> 00:02:01,088
You too dear
64
00:02:01,600 --> 00:02:03,136
And that would change the draw order
65
00:02:03,392 --> 00:02:03,904
Such that
66
00:02:04,160 --> 00:02:05,952
That area is now behind
67
00:02:06,720 --> 00:02:07,744
So that we can see it better
68
00:02:08,000 --> 00:02:09,792
So we do need to configure
69
00:02:10,048 --> 00:02:12,096
The collision layer in the collision mass
70
00:02:13,632 --> 00:02:14,912
Remember how we did
71
00:02:15,168 --> 00:02:15,680
4
72
00:02:15,936 --> 00:02:16,960
The player in the air
73
00:02:17,472 --> 00:02:18,496
Character body 2
74
00:02:19,008 --> 00:02:19,776
Because we didn't
75
00:02:20,032 --> 00:02:22,336
1 to 10 to count as terrain
76
00:02:22,592 --> 00:02:24,640
We want them to only look for today
77
00:02:25,664 --> 00:02:26,688
Act as two
78
00:02:27,200 --> 00:02:31,296
Give me the same deal here now before we configure the collision layer in the collision
79
00:02:31,808 --> 00:02:32,832
Let's go to Prague
80
00:02:33,344 --> 00:02:34,112
Project set
81
00:02:34,624 --> 00:02:36,928
Let's go ahead and scroll down until we see
82
00:02:37,440 --> 00:02:39,232
The layer names section
83
00:02:39,488 --> 00:02:41,024
And then click to die for
84
00:02:41,536 --> 00:02:43,072
R32 physics layers
85
00:02:43,328 --> 00:02:49,216
And what does tool allows us to do a w b settings allowed to do is provide names from his lair so we're not referencing
86
00:02:49,472 --> 00:02:50,240
Buy number
87
00:02:50,496 --> 00:02:51,264
And forgetting
88
00:02:51,520 --> 00:02:53,312
How are using all the layers in our game
89
00:02:53,568 --> 00:02:55,360
My middle name Leah one
90
00:02:56,384 --> 00:02:58,176
I'm going to name layer two player
91
00:02:58,432 --> 00:02:59,200
I'm going to name
92
00:02:59,456 --> 00:02:59,968
Layers
93
00:03:00,480 --> 00:03:00,992
Anime
94
00:03:01,248 --> 00:03:02,272
Close app
95
00:03:02,528 --> 00:03:04,832
Hover over these lair B here
96
00:03:05,088 --> 00:03:06,624
You can see that it'll tell me
97
00:03:06,880 --> 00:03:08,160
This is the terrain layer
98
00:03:08,416 --> 00:03:09,440
This is the player
99
00:03:11,488 --> 00:03:12,256
That's very heavy
100
00:03:12,512 --> 00:03:14,304
So what we're going to want to happen
101
00:03:14,560 --> 00:03:15,072
Is
102
00:03:15,328 --> 00:03:17,376
The abilities at the player cast
103
00:03:17,632 --> 00:03:18,912
Are going to be
104
00:03:19,168 --> 00:03:20,448
In a lair
105
00:03:20,960 --> 00:03:22,496
Dad the enemy
106
00:03:22,752 --> 00:03:24,032
I will look for
107
00:03:24,288 --> 00:03:29,920
So again the layer is where does this collision exist what layer does the
108
00:03:30,176 --> 00:03:30,688
Existing
109
00:03:30,944 --> 00:03:31,968
And the mask is
110
00:03:32,480 --> 00:03:33,248
Which layer
111
00:03:33,504 --> 00:03:35,040
Am I looking for
112
00:03:35,552 --> 00:03:36,064
4k
113
00:03:36,576 --> 00:03:39,392
This case we're going to set the enemies
114
00:03:39,648 --> 00:03:40,416
Collision layer
115
00:03:40,672 --> 00:03:41,696
20
116
00:03:42,208 --> 00:03:44,000
I'm going to set up enemies collision
117
00:03:44,256 --> 00:03:44,768
2
118
00:03:45,024 --> 00:03:45,536
Anime
119
00:03:45,792 --> 00:03:48,352
So essentially what this is saying is this the same
120
00:03:48,608 --> 00:03:49,888
This area to do
121
00:03:50,144 --> 00:03:51,168
Is going to look
122
00:03:51,424 --> 00:03:52,960
Any collision
123
00:03:53,472 --> 00:03:54,240
That exist
124
00:03:54,496 --> 00:03:55,264
In the lair
125
00:03:55,520 --> 00:03:56,032
Anime
126
00:03:56,288 --> 00:03:58,080
No I know that can be a little bit confused
127
00:03:58,592 --> 00:04:02,688
And you might be thinking what does it make more sense to put the enemy in the layer
128
00:04:02,944 --> 00:04:06,016
And then make the ability the thing that scans for the
129
00:04:06,528 --> 00:04:12,672
And I would say that yes that does make more logical sense but that's not going to work and the reason is because
130
00:04:12,928 --> 00:04:16,256
We cannot detect collisions from an area 2D
131
00:04:16,512 --> 00:04:17,536
If it's
132
00:04:17,791 --> 00:04:18,815
Existing in the
133
00:04:19,327 --> 00:04:20,863
We have to actually be looking
134
00:04:21,375 --> 00:04:22,911
With the mask to get
135
00:04:23,167 --> 00:04:23,679
Detection
136
00:04:23,935 --> 00:04:28,543
I know that's a little bit hard but basically you can envision later as being a passive
137
00:04:29,055 --> 00:04:31,871
Part of the collision and mask is the act
138
00:04:32,639 --> 00:04:34,431
So the weather is just saying
139
00:04:34,687 --> 00:04:37,503
Hey other things in the game I'm on the Slayers
140
00:04:37,759 --> 00:04:38,527
Can to live with me
141
00:04:38,783 --> 00:04:39,807
And the mask you're saying
142
00:04:40,063 --> 00:04:43,391
Hey other things in the game I want to see if I'm colliding
143
00:04:43,903 --> 00:04:46,463
I think that's pretty clear you can read the documentation
144
00:04:46,719 --> 00:04:47,231
Collision
145
00:04:48,255 --> 00:04:49,023
There is quite a bit
146
00:04:50,047 --> 00:04:54,911
It might help but we're going to move on so I've sent this to be on the enemy mask and no layers
147
00:04:55,167 --> 00:04:58,239
And now what we're going to do is we're going to go to the sword
148
00:04:59,007 --> 00:05:02,335
And we're going to do the same thing so go ahead and create a new area too
149
00:05:02,847 --> 00:05:04,895
By hitting control a or a right click
150
00:05:05,407 --> 00:05:09,247
And then add a child node of collision shape 2D
151
00:05:09,759 --> 00:05:10,527
Just like weed
152
00:05:10,783 --> 00:05:12,831
In this case I'm going to set my ship
153
00:05:13,087 --> 00:05:13,599
To be
154
00:05:13,855 --> 00:05:15,647
New rectangle shape
155
00:05:15,903 --> 00:05:17,439
Today 11 in today
156
00:05:17,695 --> 00:05:18,719
I'm going to set the size
157
00:05:18,975 --> 00:05:19,487
230
158
00:05:19,999 --> 00:05:20,511
30
159
00:05:20,767 --> 00:05:24,607
Something that looks a little bit alright first I'm going to grab this
160
00:05:24,863 --> 00:05:27,167
Colours and shape I'm going to select the move to
161
00:05:27,423 --> 00:05:28,959
And then I'm going to move it over
162
00:05:29,471 --> 00:05:31,263
Until the left edge of the
163
00:05:31,519 --> 00:05:32,031
What is a line
164
00:05:32,287 --> 00:05:33,311
Through the centre of
165
00:05:33,823 --> 00:05:34,591
Now I am I
166
00:05:35,103 --> 00:05:37,407
Because this is going to give the sword a direction
167
00:05:37,663 --> 00:05:38,431
In terms of wish
168
00:05:38,687 --> 00:05:39,199
The tackle
169
00:05:39,455 --> 00:05:40,479
So animation
170
00:05:40,991 --> 00:05:42,271
If I play the animation here
171
00:05:42,527 --> 00:05:44,575
Attacking in this area
172
00:05:44,831 --> 00:05:49,439
So I'm moving the hip-hop so that it encompasses roughly
173
00:05:49,695 --> 00:05:50,207
That
174
00:05:50,463 --> 00:05:51,231
Swing anime
175
00:05:51,487 --> 00:05:51,999
Area
176
00:05:52,255 --> 00:05:58,143
And again it's ok if your collision box is larger than the visuals that actually preferred
177
00:05:58,399 --> 00:05:58,911
Because it make
178
00:05:59,167 --> 00:05:59,679
Feel better
179
00:05:59,935 --> 00:06:02,751
Another benefit of doing this is that when we rotate the song
180
00:06:03,519 --> 00:06:05,567
With the rotate tool website
181
00:06:05,823 --> 00:06:07,103
Concealable hitbox
182
00:06:07,359 --> 00:06:09,407
Automatically aligns itself in the door
183
00:06:09,663 --> 00:06:11,455
So simply by
184
00:06:11,711 --> 00:06:13,247
Rotating the root node
185
00:06:13,503 --> 00:06:15,295
Everything will follow
186
00:06:15,551 --> 00:06:16,063
And it will be
187
00:06:16,319 --> 00:06:16,831
Paul
188
00:06:17,087 --> 00:06:20,415
Good so let's go ahead and open up the animation player
189
00:06:20,927 --> 00:06:23,999
And you can again make sure that the animation tab is high
190
00:06:24,255 --> 00:06:24,767
At the bottom
191
00:06:25,023 --> 00:06:26,815
Select the swing animation
192
00:06:27,071 --> 00:06:27,583
And
193
00:06:27,839 --> 00:06:29,375
Let's zoom in a little bit with the
194
00:06:29,631 --> 00:06:30,399
Mental on a bottom
195
00:06:31,167 --> 00:06:32,703
So we want to start
196
00:06:32,959 --> 00:06:33,983
Hitbox of
197
00:06:34,495 --> 00:06:35,007
Disable
198
00:06:35,519 --> 00:06:37,311
Because there is a small wind-up toy
199
00:06:37,823 --> 00:06:38,335
Animation
200
00:06:38,591 --> 00:06:40,383
I'm going to select the collision shape to
201
00:06:40,895 --> 00:06:42,687
I'm going to go down to the disabled proper
202
00:06:42,943 --> 00:06:43,711
I'm going to cry
203
00:06:43,967 --> 00:06:46,527
On so distant grey which means that it's not
204
00:06:46,783 --> 00:06:47,295
Is it going to do
205
00:06:48,319 --> 00:06:49,599
And I'm going to collect the key
206
00:06:49,855 --> 00:06:50,367
And then
207
00:06:50,623 --> 00:06:51,135
Create
208
00:06:51,391 --> 00:06:52,671
And so that will start off
209
00:06:52,927 --> 00:06:54,463
Disabled
210
00:06:54,719 --> 00:06:55,231
Play Mission starts
211
00:06:55,487 --> 00:06:58,559
I'm going to scrub forward until the sword starts attack
212
00:06:59,071 --> 00:06:59,839
Which is sad
213
00:07:00,095 --> 00:07:00,607
2 seconds
214
00:07:00,863 --> 00:07:02,911
I'm going to insert a key at this
215
00:07:03,167 --> 00:07:04,447
Position in the timeline
216
00:07:04,703 --> 00:07:07,263
And then I'm going to click on Nike and under
217
00:07:07,775 --> 00:07:09,311
You can see now if I scrub through
218
00:07:09,567 --> 00:07:11,871
As soon as it hits point to it becomes unable to
219
00:07:12,383 --> 00:07:13,919
I'm going to leave enabled until
220
00:07:14,175 --> 00:07:15,967
For and then I'm going to write
221
00:07:16,479 --> 00:07:17,759
Honour disable track
222
00:07:18,015 --> 00:07:18,783
Insert
223
00:07:19,295 --> 00:07:20,831
Mcconnachie frame and
224
00:07:21,599 --> 00:07:24,159
Essentially what we're going to see it
225
00:07:24,415 --> 00:07:26,719
Is startup disabled it becomes a neighbour
226
00:07:26,975 --> 00:07:27,743
4.2 seconds
227
00:07:27,999 --> 00:07:29,535
The duration of the sword swing
228
00:07:29,791 --> 00:07:30,815
And it is disabled
229
00:07:31,583 --> 00:07:33,887
So doing this point to second windows when it will be
230
00:07:34,143 --> 00:07:34,655
Detect
231
00:07:35,935 --> 00:07:39,775
What's click on the area2d mode in Arsene dark here
232
00:07:40,031 --> 00:07:43,359
And then scroll down to the collision layer collision mask setting
233
00:07:43,871 --> 00:07:46,943
This is going to be the opposite of what we are doing for the end
234
00:07:47,455 --> 00:07:48,991
We want this to
235
00:07:49,247 --> 00:07:50,527
Passively in a lair
236
00:07:50,783 --> 00:07:52,063
So we're going to answer
237
00:07:52,319 --> 00:07:54,367
The train bit and turn on
238
00:07:55,391 --> 00:07:57,695
And we actually don't want to be active
239
00:07:57,951 --> 00:07:59,487
Looking for or listen
240
00:07:59,999 --> 00:08:00,511
Any colour
241
00:08:01,023 --> 00:08:02,303
So I'm going to turn the mask off
242
00:08:02,815 --> 00:08:03,327
Ok
243
00:08:03,583 --> 00:08:07,167
So there is one final thing to do which is that we actually need to handle these
244
00:08:07,423 --> 00:08:10,495
Because decorations are being detected but nothing is being done
245
00:08:11,007 --> 00:08:13,311
So I'm going to go back to my basic
246
00:08:13,823 --> 00:08:16,639
I'm going to click on the Script icon to open up the Script
247
00:08:16,895 --> 00:08:17,407
NRG
248
00:08:17,919 --> 00:08:19,967
Shove the animation draw back down so
249
00:08:20,223 --> 00:08:20,991
PC World
250
00:08:21,247 --> 00:08:22,015
And
251
00:08:22,271 --> 00:08:23,039
In here
252
00:08:23,295 --> 00:08:27,135
Very similar to how we connected to the timer within a connect to the area
253
00:08:27,903 --> 00:08:29,183
So if you click on the area too
254
00:08:29,439 --> 00:08:31,487
And you go to the Note Tab
255
00:08:31,743 --> 00:08:32,767
You can see that
256
00:08:33,023 --> 00:08:36,351
Here are all of our area 2D signals listed right here
257
00:08:36,607 --> 00:08:38,655
The Wonder interested in his area
258
00:08:38,911 --> 00:08:40,703
Which is going to as it says
259
00:08:40,959 --> 00:08:41,727
Omit
260
00:08:41,983 --> 00:08:43,519
When they received area
261
00:08:44,543 --> 00:08:45,311
This area
262
00:08:45,823 --> 00:08:46,847
So we're going to go out on Saturday
263
00:08:47,103 --> 00:08:50,431
So in our base Academy Script I'm going to replace the pass
264
00:08:50,687 --> 00:08:51,967
In the Rain method with
265
00:08:52,223 --> 00:08:53,503
Dollar sign area two
266
00:08:53,759 --> 00:08:56,831
What again is shorthand for getnode area 2
267
00:08:57,599 --> 00:08:58,111
Dad
268
00:08:58,367 --> 00:08:59,647
Area entered
269
00:08:59,903 --> 00:09:00,927
Which is the signal name
270
00:09:02,975 --> 00:09:03,487
On
271
00:09:05,279 --> 00:09:08,095
Price to find an area entered function by 2
272
00:09:08,351 --> 00:09:08,863
Funk
273
00:09:09,119 --> 00:09:10,399
On area
274
00:09:11,167 --> 00:09:14,239
And you have to be very careful when you're connecting to signal
275
00:09:14,751 --> 00:09:15,263
Because
276
00:09:15,519 --> 00:09:18,079
Some of them pass arguments so in this example
277
00:09:18,335 --> 00:09:21,919
Area entered is passing in an area 2D
278
00:09:22,175 --> 00:09:26,015
As an argument so we need to actually accept that some Guinness call other area
279
00:09:26,527 --> 00:09:27,551
Area2d
280
00:09:28,063 --> 00:09:29,599
And then a colon at the end
281
00:09:30,111 --> 00:09:32,671
And what we going to do in here or just going to for now
282
00:09:32,927 --> 00:09:33,951
Too cute
283
00:09:34,207 --> 00:09:39,327
So this is the same method that we called from the animation player in the sword ability
284
00:09:39,583 --> 00:09:45,727
From code this time and what this is going to do as a refresher is this is going to at the appropriate
285
00:09:45,983 --> 00:09:46,495
Time
286
00:09:47,519 --> 00:09:50,591
The Entity from memory and remove it from the sea
287
00:09:51,103 --> 00:09:53,151
Not not order it'll be removed from
288
00:09:53,407 --> 00:09:53,919
And then
289
00:09:54,175 --> 00:09:54,943
Read from net
290
00:09:55,455 --> 00:09:58,783
If we did everything correctly we should be able to run the game in sea there
291
00:09:59,295 --> 00:10:00,319
Enemies will start
292
00:10:00,345 --> 00:10:02,504
Subtitled by
online-courses.club
We compress knowledge for you!
293
00:10:02,505 --> 00:10:01,343
Being destroyed
294
00:10:01,599 --> 00:10:02,367
So you can see
295
00:10:02,623 --> 00:10:06,207
When a collides the enemy will be destroyed now we can see this a little bit better
296
00:10:06,463 --> 00:10:07,231
If we go to
297
00:10:07,487 --> 00:10:08,511
De Bogota
298
00:10:09,023 --> 00:10:10,815
And turn on visible collision
299
00:10:11,583 --> 00:10:12,863
Never Run the game again
300
00:10:13,119 --> 00:10:15,679
Now we can see all of the blue collision
301
00:10:16,191 --> 00:10:17,727
And we can even see the sword
302
00:10:17,983 --> 00:10:20,287
When the sword part of you can see that there is a l
303
00:10:20,799 --> 00:10:21,567
Blue Square
304
00:10:21,823 --> 00:10:23,359
So is one problem still
305
00:10:23,615 --> 00:10:26,943
Which is that the sword is not being angled toward the end
306
00:10:27,199 --> 00:10:31,039
So I can only hit the anime if it's facing a very specific Direct
307
00:10:31,295 --> 00:10:32,575
Answer the way that we're going to fix
308
00:10:33,087 --> 00:10:36,159
Is we're going to go back to the sword ability
309
00:10:36,415 --> 00:10:37,183
Controller
310
00:10:37,439 --> 00:10:40,255
So control shift open your quick access
311
00:10:40,767 --> 00:10:43,583
Look for the sword ability controller open
312
00:10:43,839 --> 00:10:46,143
And you can open up the script with the Script
313
00:10:46,655 --> 00:10:48,703
So here's are on time or time
314
00:10:49,215 --> 00:10:49,983
You can see that
315
00:10:51,007 --> 00:10:51,519
Getting
316
00:10:51,775 --> 00:10:54,079
It's been spun at the my position however
317
00:10:54,335 --> 00:10:55,615
Is that being angle
318
00:10:55,871 --> 00:10:56,383
Taured
319
00:10:57,151 --> 00:10:58,175
So how we can do
320
00:10:58,431 --> 00:11:02,527
What we can do is weekend crab the direction vector
321
00:11:02,783 --> 00:11:03,551
Between
322
00:11:03,807 --> 00:11:05,087
The enemy Anderson
323
00:11:05,599 --> 00:11:08,159
So let's say via enemy Direction
324
00:11:09,183 --> 00:11:10,207
Is equal to
325
00:11:10,463 --> 00:11:11,487
Let's grab
326
00:11:11,743 --> 00:11:12,767
Enemies
327
00:11:14,303 --> 00:11:15,583
Global position
328
00:11:16,607 --> 00:11:17,119
Miners
329
00:11:17,631 --> 00:11:18,655
Sword
330
00:11:19,423 --> 00:11:20,447
Global
331
00:11:22,239 --> 00:11:23,263
And remember
332
00:11:23,519 --> 00:11:24,543
When you're doing that
333
00:11:25,055 --> 00:11:28,127
Subtraction to get the direction between two points
334
00:11:28,383 --> 00:11:28,895
The
335
00:11:29,151 --> 00:11:31,199
Position that you want to Vector point
336
00:11:31,711 --> 00:11:32,479
Should come
337
00:11:32,735 --> 00:11:37,599
So we're basically take the enemy position at that enemy position from
338
00:11:38,111 --> 00:11:39,135
The Sword in
339
00:11:39,391 --> 00:11:42,463
Global position and then we can say sword instance
340
00:11:43,743 --> 00:11:44,511
Rotation
341
00:11:46,815 --> 00:11:47,839
Is equal to
342
00:11:48,351 --> 00:11:49,375
Enemy Direction
343
00:11:52,959 --> 00:11:56,287
So this is saying is this is same get the angle of that fact
344
00:11:56,543 --> 00:11:59,103
That represents the direction from the sword
345
00:11:59,359 --> 00:11:59,871
To the edge
346
00:12:00,383 --> 00:12:02,175
And then set the swords rotation
347
00:12:02,431 --> 00:12:04,735
This rotation is in radians
348
00:12:04,991 --> 00:12:07,807
That's fine because this duck angle Returns
349
00:12:08,063 --> 00:12:10,623
So let's go back to the game and see if that works
350
00:12:14,719 --> 00:12:16,511
And funny thing is there
351
00:12:17,023 --> 00:12:19,583
This technically works but it's not working because
352
00:12:19,839 --> 00:12:23,679
The enemy position and the sword position are exactly the same
353
00:12:23,935 --> 00:12:26,239
So one thing we can do as we can do
354
00:12:26,751 --> 00:12:30,335
Set a sword position to be in a random radius away
355
00:12:30,591 --> 00:12:31,359
From the edge
356
00:12:31,615 --> 00:12:35,967
So let's go ahead and give the sword a little bit of a random offset so we're going to say
357
00:12:36,223 --> 00:12:36,735
London
358
00:12:36,991 --> 00:12:40,063
Weather assigning global position of the sword where they say
359
00:12:40,319 --> 00:12:41,343
Sword in stone
360
00:12:41,599 --> 00:12:42,879
Dan global position
361
00:12:43,391 --> 00:12:44,159
Plus equal
362
00:12:44,671 --> 00:12:45,183
We're going
363
00:12:45,439 --> 00:12:46,207
Take a
364
00:12:46,463 --> 00:12:46,975
Right
365
00:12:47,231 --> 00:12:47,743
Vector
366
00:12:48,255 --> 00:12:49,535
We're gonna rotate
367
00:12:49,791 --> 00:12:50,303
Bye
368
00:12:50,559 --> 00:12:53,119
Something between Llandaff range
369
00:12:53,375 --> 00:12:54,655
I'm really go from 0
370
00:12:54,911 --> 00:12:55,423
2
371
00:12:56,959 --> 00:13:01,567
And this my brother will be confusing but basically remember a vector to that right
372
00:13:01,823 --> 00:13:03,615
Has a rotation of 0
373
00:13:03,871 --> 00:13:05,919
We're going to take that within a rotated
374
00:13:06,175 --> 00:13:10,015
Buy anywhere from 0 to 2pi since when radiant so this is the same as
375
00:13:10,271 --> 00:13:12,575
Randomise the rotation of this vector
376
00:13:12,831 --> 00:13:14,367
From 0 to 360 degree
377
00:13:14,879 --> 00:13:17,439
Tau is just a constant that represents to pi
378
00:13:17,695 --> 00:13:19,231
So that we don't have to write tutor
379
00:13:20,255 --> 00:13:25,887
So that's going to be our rotation and then we're going to give it some offset so we're gonna x let's safe
380
00:13:26,399 --> 00:13:27,167
So saying
381
00:13:27,423 --> 00:13:33,567
A vector that points in a random Direction so this is a unit vector that points in a random Direction X
382
00:13:33,823 --> 00:13:39,199
Pixels in so now the sword is going to spawn anywhere along a circle
383
00:13:39,455 --> 00:13:40,735
That is represented
384
00:13:40,991 --> 00:13:44,319
Buy a radius of 4 around the enemy
385
00:13:44,831 --> 00:13:45,855
Hopefully that makes sense
386
00:13:46,111 --> 00:13:49,183
But now that we've offered the global position buy it for pixels
387
00:13:49,695 --> 00:13:50,463
This Direct
388
00:13:50,975 --> 00:13:51,743
Should be
389
00:13:51,999 --> 00:13:52,511
Good
390
00:13:54,303 --> 00:13:56,351
The sword is actually rooting it
391
00:13:57,119 --> 00:13:59,935
Of course there's not enough enemies to exactly see what's going on
392
00:14:00,191 --> 00:14:02,239
I'm going to pop over to our main scene
393
00:14:02,495 --> 00:14:04,799
And duplicate the enemy again
394
00:14:05,311 --> 00:14:07,103
And then use w to move it around
395
00:14:07,359 --> 00:14:08,895
I'm going to do another one
396
00:14:09,407 --> 00:14:10,431
Duplicate another one
397
00:14:10,687 --> 00:14:12,479
Basically just put as many enemies
398
00:14:12,735 --> 00:14:13,247
You want
399
00:14:13,503 --> 00:14:14,271
In your lover
400
00:14:14,527 --> 00:14:15,551
What's going on run it now
401
00:14:15,807 --> 00:14:16,831
I'll give you a ring
402
00:14:17,087 --> 00:14:17,599
Opportune
403
00:14:17,855 --> 00:14:18,623
Play the test and
404
00:14:19,135 --> 00:14:22,975
Can you can you go to sort can actually attack multiple enemies which is good because
405
00:14:23,231 --> 00:14:24,255
Games like this
406
00:14:24,511 --> 00:14:26,047
Like vampire survivors
407
00:14:26,303 --> 00:14:27,839
And other games and leisure
408
00:14:28,095 --> 00:14:29,887
Do you have abilities that
409
00:14:30,143 --> 00:14:30,911
Hit multiple enemies
410
00:14:32,447 --> 00:14:36,543
Much more work to be done as it relates to abilities and combat
411
00:14:36,799 --> 00:14:37,311
But
412
00:14:37,567 --> 00:14:39,615
We've got the foundation in place
413
00:14:39,871 --> 00:14:41,407
For future
26575
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.