1
00:00:00,000 --> 00:00:03,630
Welcome back my fellow game developers

2
00:00:03,630 --> 00:00:04,950
to a brand new video.

3
00:00:04,950 --> 00:00:07,050
And in this one, if I maximize on

4
00:00:07,050 --> 00:00:09,870
play to see everything when I run the game,

5
00:00:09,870 --> 00:00:12,750
you'll notice that the boss appeal

6
00:00:12,750 --> 00:00:14,910
from the ground and starts walking towards us.

7
00:00:14,910 --> 00:00:17,160
And when he gets to a certain position,

8
00:00:17,160 --> 00:00:19,920
he starts collaborating us clobbering.

9
00:00:19,920 --> 00:00:22,760
Is that even a proper verb?

10
00:00:22,755 --> 00:00:26,105
He starts clobbering us with his giant salt.

11
00:00:26,100 --> 00:00:28,140
So that's not waste any more time.

12
00:00:28,140 --> 00:00:30,680
And let's get started.

13
00:00:30,675 --> 00:00:35,985
Oh, okay, So now let's make the enemy actually

14
00:00:35,985 --> 00:00:38,165
walk or not enemy the boss actually

15
00:00:38,160 --> 00:00:41,150
start walking Towards the player.

16
00:00:41,150 --> 00:00:43,730
So how are we going to do this?

17
00:00:43,730 --> 00:00:45,140
If we go to the animator,

18
00:00:45,140 --> 00:00:47,960
first thing we want to do is we want to transition

19
00:00:47,960 --> 00:00:50,840
from the appear to the actual walking.

20
00:00:50,840 --> 00:00:55,310
So I'm going to create a transition into the walking.

21
00:00:55,310 --> 00:00:57,560
And there is going to be no condition.

22
00:00:57,560 --> 00:01:00,380
There is only going to be an exit time and

23
00:01:00,380 --> 00:01:03,940
maybe a transition duration that see how that looks.

24
00:01:03,935 --> 00:01:06,265
So the enemy appears and there you go.

25
00:01:06,260 --> 00:01:08,860
You can see that when he finishes appearing,

26
00:01:08,855 --> 00:01:10,895
he then transitions into the walking.

27
00:01:10,895 --> 00:01:12,055
You can play around in here.

28
00:01:12,050 --> 00:01:13,430
So for example, let's increase

29
00:01:13,430 --> 00:01:15,650
the exit time to 97 percent.

30
00:01:15,650 --> 00:01:18,130
So we've finished his appearing completely.

31
00:01:18,125 --> 00:01:19,825
Let's see how that looks.

32
00:01:19,820 --> 00:01:23,200
Okay, so there is kind of an error here.

33
00:01:23,195 --> 00:01:25,955
And I want to do all of this in front of you

34
00:01:25,955 --> 00:01:28,705
just so you can see how things happen.

35
00:01:28,700 --> 00:01:30,980
Maybe it will take a bit of time more from the video,

36
00:01:30,980 --> 00:01:33,100
but I have to show you this.

37
00:01:33,095 --> 00:01:35,165
I don't want any confusion anyways.

38
00:01:35,165 --> 00:01:36,785
Now that we have the walking,

39
00:01:36,785 --> 00:01:39,305
it's actually time to first of all,

40
00:01:39,305 --> 00:01:41,975
find the transform of the player,

41
00:01:41,975 --> 00:01:43,345
get a rigid body,

42
00:01:43,340 --> 00:01:46,520
find the direction, and so on, add the velocity.

43
00:01:46,520 --> 00:01:48,770
How are we going to do this?

44
00:01:48,770 --> 00:01:50,390
Well, as you know,

45
00:01:50,390 --> 00:01:53,270
we have all of these states setup right here.

46
00:01:53,270 --> 00:01:54,440
So what I'm going to do,

47
00:01:54,440 --> 00:01:56,980
I'm going to click on the walking.

48
00:01:56,975 --> 00:01:59,005
And you can see right here that I can

49
00:01:59,000 --> 00:02:01,060
add something called a behavior.

50
00:02:01,055 --> 00:02:03,195
So let's click on Add behavior.

51
00:02:03,199 --> 00:02:05,929
Let's go ahead and create a new script.

52
00:02:05,930 --> 00:02:08,990
And instead of boss getting angry for some reason,

53
00:02:08,990 --> 00:02:12,040
we are going to call this the boss walk.

54
00:02:12,035 --> 00:02:15,935
So adding a behavior script to a state

55
00:02:15,935 --> 00:02:18,005
has a different type of

56
00:02:18,005 --> 00:02:20,425
naming convention I'm going to use.

57
00:02:20,420 --> 00:02:23,240
Actually MY unit uses the underscore,

58
00:02:23,240 --> 00:02:27,250
so I'm going to keep with that standard, let's say.

59
00:02:27,245 --> 00:02:28,685
So create an ad,

60
00:02:28,685 --> 00:02:31,015
wait for the file to be imported.

61
00:02:31,010 --> 00:02:33,730
And there we go. Now we have the post-war.

62
00:02:33,725 --> 00:02:37,315
If we click on and see where that actually is,

63
00:02:37,310 --> 00:02:39,360
there we go In the assets.

64
00:02:39,360 --> 00:02:41,800
It's immediately in the assets.

65
00:02:41,800 --> 00:02:45,540
So if any day now,

66
00:02:45,535 --> 00:02:48,325
if I make this a bit bigger so

67
00:02:48,325 --> 00:02:51,895
we can properly see the folders.

68
00:02:52,260 --> 00:02:55,830
And you can see that it's just on the assets.

69
00:02:55,825 --> 00:02:57,735
And for that reason, I'm going to

70
00:02:57,730 --> 00:02:59,590
go into the scripts in here,

71
00:02:59,590 --> 00:03:02,830
right-click and create a new folder

72
00:03:02,830 --> 00:03:06,780
for the boss or boss system.

73
00:03:06,775 --> 00:03:08,485
Let's call it the POS system.

74
00:03:08,485 --> 00:03:11,965
Hit Enter and then backend the assets.

75
00:03:11,965 --> 00:03:17,775
Will drag this into the boss. There we go.

76
00:03:17,770 --> 00:03:20,310
And the boss click on walking.

77
00:03:20,305 --> 00:03:22,615
Is the script still there?

78
00:03:22,615 --> 00:03:27,745
So the new version of Unity is extremely valid anyways,

79
00:03:27,745 --> 00:03:29,695
hopefully yours doesn't take so long

80
00:03:29,695 --> 00:03:32,935
to compile and understand everything.

81
00:03:32,935 --> 00:03:34,605
So now let's double-click on

82
00:03:34,600 --> 00:03:37,900
the boardwalk and let's see what we have in here.

83
00:03:37,900 --> 00:03:42,190
As you can see, we don't have a mono behavior anymore.

84
00:03:42,190 --> 00:03:43,650
As you can see right here,

85
00:03:43,645 --> 00:03:47,275
Mano behavior is usually reserved to

86
00:03:47,275 --> 00:03:51,655
a script that will be attached to a game object.

87
00:03:51,655 --> 00:03:53,475
So something that will move.

88
00:03:53,470 --> 00:03:54,760
For example, in here,

89
00:03:54,760 --> 00:03:56,350
we don't have a motor behavior,

90
00:03:56,350 --> 00:03:58,540
we have a state machine behavior.

91
00:03:58,540 --> 00:04:00,300
And this is a script that is

92
00:04:00,295 --> 00:04:03,725
attached only to certain states.

93
00:04:03,729 --> 00:04:05,749
So Let's continue one,

94
00:04:05,750 --> 00:04:06,920
what do we have here?

95
00:04:06,920 --> 00:04:08,470
Just like we have the start and

96
00:04:08,465 --> 00:04:10,315
update on the mono behavior,

97
00:04:10,310 --> 00:04:13,990
we have the on-state Enter and the on-state update.

98
00:04:13,985 --> 00:04:16,765
We also have the on-state exit,

99
00:04:16,760 --> 00:04:20,600
on-state move and the on-state IQ, whatever that is.

100
00:04:20,600 --> 00:04:24,520
Anyways, we will not be focusing on the last two,

101
00:04:24,515 --> 00:04:26,585
so we can go ahead and delete them.

102
00:04:26,585 --> 00:04:29,165
And in here, I'm going to select

103
00:04:29,164 --> 00:04:32,254
all of these lines because they are commented out.

104
00:04:32,255 --> 00:04:34,565
And we can uncomment

105
00:04:34,565 --> 00:04:38,495
everything using the control shift or not,

106
00:04:38,495 --> 00:04:42,275
sorry, Control K, you.

107
00:04:42,700 --> 00:04:44,410
There we go.

108
00:04:44,405 --> 00:04:46,405
So make sure that to hold down

109
00:04:46,400 --> 00:04:49,010
Control and press K you at the same time.

110
00:04:49,010 --> 00:04:51,380
As you can see, we have a lot of errors.

111
00:04:51,380 --> 00:04:55,000
And that's because these lines are actually the comments.

112
00:04:54,995 --> 00:04:58,105
So just like in here we have over the update,

113
00:04:58,100 --> 00:04:59,660
the comment update is called

114
00:04:59,660 --> 00:05:01,370
every frame you can see in here,

115
00:05:01,370 --> 00:05:04,810
on-state enter is called when a transition starts,

116
00:05:04,805 --> 00:05:07,135
and on-state update is called each

117
00:05:07,130 --> 00:05:09,860
update and on exit is called on the transitions.

118
00:05:09,860 --> 00:05:11,570
And okay, Excellent.

119
00:05:11,570 --> 00:05:13,570
So now let's continue on.

120
00:05:13,565 --> 00:05:15,775
In here I'm going to create first of all,

121
00:05:15,770 --> 00:05:21,580
the transform for the layer to chase.

122
00:05:21,575 --> 00:05:23,845
Then I'm going to get.

123
00:05:23,840 --> 00:05:25,960
A rigid body 2D.

124
00:05:25,955 --> 00:05:31,015
So boss rigid body, no boss.

125
00:05:31,010 --> 00:05:34,600
Rigid body 2D.

126
00:05:34,595 --> 00:05:36,655
Or you know what? Let's not going to have to

127
00:05:36,650 --> 00:05:38,300
lead this whole game is a 2D game,

128
00:05:38,300 --> 00:05:40,040
so we won't need that and

129
00:05:40,040 --> 00:05:45,850
a vector three dot direction to move.

130
00:05:45,845 --> 00:05:48,565
And so just like regular enemies,

131
00:05:48,560 --> 00:05:53,290
we have the components of the boss walking and so on.

132
00:05:53,285 --> 00:05:55,055
So now that we have these,

133
00:05:55,055 --> 00:05:57,505
it's time for a bit of a challenge.

134
00:05:57,500 --> 00:05:59,480
And your challenge is going to be to

135
00:05:59,480 --> 00:06:02,410
find the IP layer and get the rigid body.

136
00:06:02,405 --> 00:06:03,655
So first of all,

137
00:06:03,650 --> 00:06:07,310
think of where we should be getting all the references.

138
00:06:07,310 --> 00:06:09,550
So usually we use the start,

139
00:06:09,545 --> 00:06:11,245
but now we don't have stopped.

140
00:06:11,240 --> 00:06:12,880
So where should we be?

141
00:06:12,875 --> 00:06:15,535
You think where we should be using a,

142
00:06:15,530 --> 00:06:18,050
where should we be getting all of our components?

143
00:06:18,050 --> 00:06:21,290
Then we'll need to find the player, obviously.

144
00:06:21,290 --> 00:06:25,130
Then we'll need to get the rigid body on the boss.

145
00:06:25,130 --> 00:06:27,470
And I'm going to give you a small hint.

146
00:06:27,470 --> 00:06:31,840
We will need to use the animator from the parameters.

147
00:06:31,835 --> 00:06:35,355
What do I mean by the animator from the parameters?

148
00:06:35,359 --> 00:06:36,889
Let me just show you that.

149
00:06:36,890 --> 00:06:38,300
So if we go in here,

150
00:06:38,300 --> 00:06:41,080
you can see that on the on-state enter,

151
00:06:41,075 --> 00:06:43,385
on state update and on-state exit,

152
00:06:43,385 --> 00:06:45,805
we have certain parameters in here,

153
00:06:45,800 --> 00:06:48,260
and one of them is the animator.

154
00:06:48,260 --> 00:06:51,670
So we have immediate access to the animator.

155
00:06:51,665 --> 00:06:53,395
That's what you're going to use

156
00:06:53,390 --> 00:06:56,090
an order to get the references.

157
00:06:56,090 --> 00:06:58,340
So back and forth to our challenge,

158
00:06:58,340 --> 00:06:59,630
this is a bit hard.

159
00:06:59,630 --> 00:07:02,030
Do your best, try different things,

160
00:07:02,030 --> 00:07:04,690
different tricks, make mistakes, do your best.

161
00:07:04,685 --> 00:07:06,455
There's no pressure on you.

162
00:07:06,455 --> 00:07:11,285
Pause the video right now and go do the challenge.

163
00:07:11,285 --> 00:07:13,675
O K will come back.

164
00:07:13,670 --> 00:07:16,610
So because we don't have start,

165
00:07:16,610 --> 00:07:19,910
we are going to use the on-state enter and away Allstate

166
00:07:19,910 --> 00:07:23,870
enter works is as soon as we enter into the state,

167
00:07:23,870 --> 00:07:26,330
we will set up the parameters and

168
00:07:26,330 --> 00:07:29,060
then we will be seeing what we want to do later on.

169
00:07:29,060 --> 00:07:30,590
For now, we're going to go

170
00:07:30,590 --> 00:07:32,540
ahead and use the player chase.

171
00:07:32,540 --> 00:07:35,300
What is the player Chase is going to be

172
00:07:35,300 --> 00:07:43,090
the game object dot find objects of type.

173
00:07:43,085 --> 00:07:46,945
Or actually where is it find object of type.

174
00:07:46,940 --> 00:07:50,200
And it's going to be the player controller.

175
00:07:50,195 --> 00:07:54,305
Note on top bullet the player controller.

176
00:07:54,305 --> 00:07:56,045
So find the object of type.

177
00:07:56,045 --> 00:07:57,835
I believe we've seen this before.

178
00:07:57,830 --> 00:08:00,560
And we used game object because we can just use

179
00:08:00,560 --> 00:08:03,890
game object without having the mono behavior up here.

180
00:08:03,890 --> 00:08:06,160
So we need the game object class.

181
00:08:06,155 --> 00:08:08,365
Then we get the final object of type.

182
00:08:08,360 --> 00:08:10,840
We get the player controller.

183
00:08:10,835 --> 00:08:12,415
And finally, we need to get

184
00:08:12,410 --> 00:08:15,970
the transport of that game object that we found.

185
00:08:15,965 --> 00:08:19,495
So now we have a reference to the player to chase.

186
00:08:19,490 --> 00:08:21,830
Next, we need the rigid bodies.

187
00:08:21,830 --> 00:08:23,030
So I'm going to say that

188
00:08:23,030 --> 00:08:31,230
the bosses rigid body is equal to the animator component.

189
00:08:32,110 --> 00:08:36,490
And we are going to get the rigid body 2D.

190
00:08:36,485 --> 00:08:40,135
And did we add a rigid body to the boss?

191
00:08:40,130 --> 00:08:43,340
Let's check that out and see if we did.

192
00:08:43,340 --> 00:08:46,250
If we click on the Skelly, not we didn't.

193
00:08:46,250 --> 00:08:50,680
So let's go ahead and add a rigid body 2D.

194
00:08:50,675 --> 00:08:53,335
There we go. So now we have a rigid body.

195
00:08:53,330 --> 00:08:55,040
And let's make sure that we

196
00:08:55,040 --> 00:08:57,130
freeze the rotation on this end.

197
00:08:57,125 --> 00:08:59,695
And we make sure that

198
00:08:59,690 --> 00:09:02,470
the grand scale to 0. There we go. Save that.

199
00:09:02,465 --> 00:09:05,945
If you don't want to be able to push your boss around,

200
00:09:05,945 --> 00:09:07,585
you can make sure to set it to either

201
00:09:07,580 --> 00:09:10,310
kinematic static or maybe even static.

202
00:09:10,310 --> 00:09:13,030
But I think he will not be able to move.

203
00:09:13,025 --> 00:09:16,195
Anyways, let's continue one now we need to make sure that

204
00:09:16,190 --> 00:09:19,460
the enemy or the boss actually starts moving.

205
00:09:19,460 --> 00:09:21,560
So where should we be doing that?

206
00:09:21,560 --> 00:09:24,380
Well, obviously it should be the opposite.

207
00:09:24,380 --> 00:09:28,000
So an update, I'm going to say that we have a vector two,

208
00:09:27,995 --> 00:09:31,475
which is the new position that we should be in.

209
00:09:31,475 --> 00:09:34,075
And it's going to be equal to the vector

210
00:09:34,070 --> 00:09:37,250
to the mist towards.

211
00:09:37,250 --> 00:09:40,300
And what should we be moving towards?

212
00:09:40,295 --> 00:09:42,775
It should be the boss dot,

213
00:09:42,770 --> 00:09:45,910
rigid body dot position.

214
00:09:45,905 --> 00:09:48,385
So this will be, as you can see right here.

215
00:09:48,380 --> 00:09:49,880
First of all, we have the current,

216
00:09:49,880 --> 00:09:51,040
then we have the target,

217
00:09:51,035 --> 00:09:53,465
then we have the distance max.

218
00:09:53,465 --> 00:09:56,065
So here we are going to go ahead

219
00:09:56,060 --> 00:09:58,810
and say that position rigid body.

220
00:09:58,805 --> 00:10:01,445
So of the bosses rigid body obviously.

221
00:10:01,445 --> 00:10:03,415
Then we are going to say that

222
00:10:03,410 --> 00:10:07,690
the player chase dot position is the target.

223
00:10:07,685 --> 00:10:16,445
And I'm going to create up here a public float speed.

224
00:10:16,445 --> 00:10:18,025
And this will be the speed at

225
00:10:18,020 --> 00:10:20,950
which we are going to be moving in.

226
00:10:20,945 --> 00:10:26,285
And then a public float back.

227
00:10:26,285 --> 00:10:28,015
Range, and this will be

228
00:10:28,010 --> 00:10:31,670
an attack range later on the tool use.

229
00:10:31,670 --> 00:10:34,910
So in here what we're going to do is we're going

230
00:10:34,910 --> 00:10:37,780
to say that we are going to move at the speed,

231
00:10:37,775 --> 00:10:40,585
but we are going to add to it Time

232
00:10:40,580 --> 00:10:47,180
dot fixed delta prime and y fixed delta time.

233
00:10:47,180 --> 00:10:48,440
And what's the difference?

234
00:10:48,440 --> 00:10:51,410
You can see in here, the interval in seconds at which

235
00:10:51,410 --> 00:10:54,610
physics and other fixed frames rate updates.

236
00:10:54,605 --> 00:10:59,845
So it's, it's almost the same as delta time,

237
00:10:59,840 --> 00:11:01,130
but it's fixed delta time.

238
00:11:01,130 --> 00:11:05,830
It just adds a bit of extra performance to the game.

239
00:11:05,825 --> 00:11:07,525
And for some reason I noticed when

240
00:11:07,520 --> 00:11:09,200
we use the regular delta time,

241
00:11:09,200 --> 00:11:15,080
we have some weird behavior because we are in a animator.

242
00:11:15,079 --> 00:11:16,419
Maybe that's the reason.

243
00:11:16,415 --> 00:11:18,115
I'm not 100% sure,

244
00:11:18,110 --> 00:11:20,570
but what I've found using fixed delta time,

245
00:11:20,570 --> 00:11:22,630
which is exactly like delta time,

246
00:11:22,625 --> 00:11:25,585
just fixed and more precise.

247
00:11:25,580 --> 00:11:27,190
So let's continue on.

248
00:11:27,185 --> 00:11:28,855
Finally, what do we want to do when

249
00:11:28,850 --> 00:11:30,820
we get into a certain range?

250
00:11:30,815 --> 00:11:33,535
We want to start attacking our player.

251
00:11:33,530 --> 00:11:37,070
So if the vector two dot

252
00:11:37,070 --> 00:11:40,790
distance between the layer

253
00:11:40,790 --> 00:11:44,870
to chase dot position and the rigid body.

254
00:11:44,870 --> 00:11:49,270
The boss rigid body dot position.

255
00:11:49,265 --> 00:11:51,715
If it's less than the attack range

256
00:11:51,710 --> 00:11:53,450
that we've created up here.

257
00:11:53,450 --> 00:11:55,750
While we were creating the speed.

258
00:11:55,745 --> 00:11:57,625
Then in here we are going to say that

259
00:11:57,620 --> 00:12:01,070
the animator that trigger,

260
00:12:01,070 --> 00:12:05,600
the set trigger and we are going to start attacking.

261
00:12:05,600 --> 00:12:08,540
So let's go back into our game.

262
00:12:08,540 --> 00:12:10,970
Let's create a transition

263
00:12:10,970 --> 00:12:13,130
between the walking and the attacking.

264
00:12:13,130 --> 00:12:17,300
And I transitioned between the attacking and the walking.

265
00:12:17,300 --> 00:12:19,670
And in here we're going to make sure that

266
00:12:19,670 --> 00:12:21,650
we don't have any extra time or not

267
00:12:21,650 --> 00:12:23,060
that actually let's skip that because

268
00:12:23,060 --> 00:12:25,730
sometimes might need it.

269
00:12:25,730 --> 00:12:29,420
So in here we are going to say that we want to attack.

270
00:12:29,420 --> 00:12:31,970
This will be the name of the trigger.

271
00:12:31,970 --> 00:12:34,820
The condition to transition from walking and

272
00:12:34,820 --> 00:12:38,080
to the attack is going to be the trigger attack.

273
00:12:38,075 --> 00:12:42,355
I'm going to paste it in here, save that.

274
00:12:42,350 --> 00:12:44,090
And now in here I'm going to

275
00:12:44,090 --> 00:12:46,390
see how are we going to get back.

276
00:12:46,385 --> 00:12:48,265
So first of all, we do,

277
00:12:48,260 --> 00:12:50,000
we go from The Walking,

278
00:12:50,000 --> 00:12:53,530
we start attacking, but then how do we get back?

279
00:12:53,525 --> 00:12:55,555
First of all, let's see how that will look.

280
00:12:55,550 --> 00:12:57,770
So I'm going to run the game

281
00:12:57,770 --> 00:13:01,220
and we are going to look at our player behavior.

282
00:13:01,220 --> 00:13:02,840
So as you can see, he appeared,

283
00:13:02,840 --> 00:13:05,060
but for some reason he is not moving

284
00:13:05,060 --> 00:13:09,160
and his slides away very easily.

285
00:13:09,155 --> 00:13:11,135
So let's go to the syllabus

286
00:13:11,135 --> 00:13:13,135
and let's see what the problem is in here.

287
00:13:13,130 --> 00:13:16,910
Maybe you should make him a bit dynamic or kinematic.

288
00:13:16,909 --> 00:13:18,459
Let's try this again.

289
00:13:18,455 --> 00:13:21,875
And again. He appears he starts walking.

290
00:13:21,875 --> 00:13:23,575
And when we are in range,

291
00:13:23,570 --> 00:13:25,990
as you can see, he is.

292
00:13:25,985 --> 00:13:27,215
There you go.

293
00:13:27,215 --> 00:13:28,765
Everything seems to be working.

294
00:13:28,760 --> 00:13:30,200
The only problem is that we

295
00:13:30,200 --> 00:13:32,110
are being rendered on top of him.

296
00:13:32,105 --> 00:13:33,995
So I'm going to go back.

297
00:13:33,995 --> 00:13:37,715
I'm going to check for these private and the boss layer.

298
00:13:37,715 --> 00:13:39,655
So this is your preference.

299
00:13:39,650 --> 00:13:40,670
Do you want to appear

300
00:13:40,670 --> 00:13:42,490
behind the boss, in front of the boss?

301
00:13:42,485 --> 00:13:44,345
But actually what we want

302
00:13:44,345 --> 00:13:46,765
is maybe to appear behind the boss.

303
00:13:46,760 --> 00:13:49,100
We don't want to be walking over the boss.

304
00:13:49,100 --> 00:13:52,320
So in the layers added,

305
00:13:53,620 --> 00:13:55,640
player, There we go.

306
00:13:55,640 --> 00:13:58,190
So now when we run the game,

307
00:13:58,190 --> 00:14:01,610
now there is an obvious problem in here that okay,

308
00:14:01,610 --> 00:14:04,940
So we are rendered behind the boss. That's good.

309
00:14:04,940 --> 00:14:06,700
He is fighting US,

310
00:14:06,695 --> 00:14:09,275
is doing one attack

311
00:14:09,275 --> 00:14:10,375
than another attack than

312
00:14:10,370 --> 00:14:12,070
walking EBIT than another attack.

313
00:14:12,065 --> 00:14:13,855
But here the problem is that he

314
00:14:13,850 --> 00:14:15,730
is still not walking towards us.

315
00:14:15,725 --> 00:14:19,135
That's because we didn't actually make the boss move.

316
00:14:19,130 --> 00:14:21,860
This was a mistake on my part.

317
00:14:21,860 --> 00:14:24,370
Rigid body on the bus.

318
00:14:24,365 --> 00:14:27,535
We can use the Move position.

319
00:14:27,530 --> 00:14:29,660
And in here we are going to sell it as

320
00:14:29,660 --> 00:14:31,990
the new position. So save that.

321
00:14:31,985 --> 00:14:33,085
You can see right here,

322
00:14:33,080 --> 00:14:34,910
Move position doesn't do,

323
00:14:34,910 --> 00:14:37,940
moves the rigid body to position, save that back.

324
00:14:37,940 --> 00:14:40,160
Now game, run the game.

325
00:14:40,160 --> 00:14:42,650
And now we should see that when the boss appears,

326
00:14:42,650 --> 00:14:45,620
he starts walking towards the layer and he

327
00:14:45,620 --> 00:14:48,680
starts hitting the player and walking towards him.

328
00:14:48,680 --> 00:14:50,480
But as you can see, he is not facing

329
00:14:50,480 --> 00:14:52,460
the right direction and he is

330
00:14:52,460 --> 00:14:54,800
stopping too close to the layer.

331
00:14:54,800 --> 00:14:56,210
That's because if we click on

332
00:14:56,210 --> 00:14:59,690
the syllabus on the walking excuse me,

333
00:14:59,690 --> 00:15:01,120
on the walking right here,

334
00:15:01,115 --> 00:15:03,355
was that you can see that the speed and

335
00:15:03,350 --> 00:15:07,240
the attack range to be maybe a bit bigger.

336
00:15:07,235 --> 00:15:13,435
So let's make it maybe five.

337
00:15:13,430 --> 00:15:16,390
Let's see how that looks. Run the game.

338
00:15:16,385 --> 00:15:19,615
And now he gets close, then you go,

339
00:15:19,610 --> 00:15:21,970
you can see he starts fighting us

340
00:15:21,965 --> 00:15:24,725
and he starts walking towards us.

341
00:15:24,725 --> 00:15:26,995
So that looks kind of good.

342
00:15:26,990 --> 00:15:28,610
I believe we don't want to

343
00:15:28,610 --> 00:15:30,970
be able to walk behind the boss.

344
00:15:30,965 --> 00:15:32,395
I don't like it a lot.

345
00:15:32,390 --> 00:15:35,680
So maybe this should not be a trigger after all.

346
00:15:35,675 --> 00:15:37,165
Maybe you should be able to

347
00:15:37,160 --> 00:15:38,900
just hit the boss on the head.

348
00:15:38,900 --> 00:15:41,800
It's not a huge deal if we can

349
00:15:41,795 --> 00:15:43,615
actually walk through this or

350
00:15:43,610 --> 00:15:45,350
you can make the, for example,

351
00:15:45,350 --> 00:15:49,220
the grid wall changed the wall

352
00:15:49,220 --> 00:15:51,170
to a certain level and make sure that

353
00:15:51,170 --> 00:15:53,270
the boss doesn't interact with wall,

354
00:15:53,270 --> 00:15:55,750
which I think is a really good idea.

355
00:15:55,745 --> 00:15:57,965
Maybe we'll test that out. Let's save that.

356
00:15:57,965 --> 00:16:01,075
But for now, everything seems to be working good.

357
00:16:01,070 --> 00:16:02,480
There is the problem of

358
00:16:02,480 --> 00:16:04,820
obviously the flipping of the enemy.

359
00:16:04,820 --> 00:16:08,500
And we have to do a couple of fixing for the movement,

360
00:16:08,495 --> 00:16:11,315
but we'll keep that for a later video.

361
00:16:11,315 --> 00:16:13,085
For now. I hope you enjoy it.

362
00:16:13,085 --> 00:16:15,065
I hope you are committing your changes

363
00:16:15,065 --> 00:16:18,395
and I'll see you in the next one.

