1
00:00:00,000 --> 00:00:03,640
Welcome back, My favorite game developers.

2
00:00:03,639 --> 00:00:05,319
And this video, as you can see,

3
00:00:05,320 --> 00:00:07,810
the UI canvas has an extra element,

4
00:00:07,810 --> 00:00:09,750
which is the death screen.

5
00:00:09,745 --> 00:00:11,905
So now when we run the game,

6
00:00:11,905 --> 00:00:13,935
we can see that we have a health.

7
00:00:13,930 --> 00:00:15,660
So we get shot once,

8
00:00:15,655 --> 00:00:17,865
we got shot twice, and there you go.

9
00:00:17,860 --> 00:00:20,760
You can see that you will die just like in Dark Souls.

10
00:00:20,755 --> 00:00:23,505
And we have this effect appearing.

11
00:00:23,500 --> 00:00:25,570
How cool is that? And not only that,

12
00:00:25,570 --> 00:00:28,440
you'll notice that we no longer have sorts

13
00:00:28,435 --> 00:00:32,025
instantiated by the enemy after the player dies,

14
00:00:32,020 --> 00:00:34,480
which is a really nice mechanic that we've

15
00:00:34,480 --> 00:00:37,420
added at the last second because I just remember that.

16
00:00:37,420 --> 00:00:39,970
So let's not waste any more time and

17
00:00:39,970 --> 00:00:43,090
let's get to creating the screen.

18
00:00:43,090 --> 00:00:46,900
Oh, okay, so time to make the death

19
00:00:46,900 --> 00:00:50,800
of our player just a little bit more exciting.

20
00:00:50,800 --> 00:00:54,740
And I've changed the pixels per unit to 15 of the tiles.

21
00:00:54,740 --> 00:00:57,940
So now we don't have these annoying blue lines.

22
00:00:57,940 --> 00:01:01,360
So I'm going to go ahead in the UI canvas and I'm going

23
00:01:01,360 --> 00:01:05,490
to create a new image.

24
00:01:05,485 --> 00:01:11,275
And this image is going to be the death screen.

25
00:01:11,610 --> 00:01:16,240
There we go. And let's just make the scene a

26
00:01:16,240 --> 00:01:18,010
little bit bigger and we are going to

27
00:01:18,010 --> 00:01:19,930
fit it into the entire screen.

28
00:01:19,930 --> 00:01:21,760
And just like we always do,

29
00:01:21,760 --> 00:01:25,590
we are going to go ahead and make it completely black.

30
00:01:25,590 --> 00:01:28,910
And then what I'm going to do is I want to get

31
00:01:28,910 --> 00:01:32,290
these so we haven't used these block trills yet.

32
00:01:32,285 --> 00:01:37,615
So I'm just going to get the 123 and the last one,

33
00:01:37,610 --> 00:01:39,500
select all of them.

34
00:01:39,500 --> 00:01:43,700
And I'm going to drag it into four.

35
00:01:43,700 --> 00:01:45,350
We do that, that's in the sprites.

36
00:01:45,350 --> 00:01:51,460
Create a folder for the blood death screen.

37
00:01:51,455 --> 00:01:53,105
How a nice course,

38
00:01:53,105 --> 00:01:57,095
a very lovely project all about blood deaf and whatnot.

39
00:01:57,095 --> 00:01:58,855
So let's see how that looks.

40
00:01:58,850 --> 00:02:00,200
And now before we do that,

41
00:02:00,200 --> 00:02:02,480
actually I believe we need to create a,

42
00:02:02,480 --> 00:02:05,330
some kind of image in here.

43
00:02:05,330 --> 00:02:08,120
So there we go, the image and I'm going

44
00:02:08,120 --> 00:02:10,460
to change this right here,

45
00:02:10,460 --> 00:02:13,030
and I'm going to set it to the native size.

46
00:02:13,025 --> 00:02:15,295
So it's kind of big.

47
00:02:15,290 --> 00:02:18,800
I'm just going to make this one setup

48
00:02:18,800 --> 00:02:23,230
donated size and maybe just increase the size of it.

49
00:02:23,225 --> 00:02:28,895
So there we go around.

50
00:02:29,410 --> 00:02:32,720
I'm going to keep preserve the aspect ratio.

51
00:02:32,720 --> 00:02:34,790
So now we can make it a bit bigger.

52
00:02:34,790 --> 00:02:38,000
So there we go. So this will splash over our screen.

53
00:02:38,000 --> 00:02:40,900
I'm going to create an animation in here.

54
00:02:40,895 --> 00:02:46,355
So I'm going to go to the animations, create and assets,

55
00:02:46,354 --> 00:02:56,634
animations, death screen, the screen, blood.

56
00:02:56,630 --> 00:03:06,290
And let's see, splash, lot on screen.

57
00:03:06,290 --> 00:03:09,320
Save that. And I'm going to add all of

58
00:03:09,320 --> 00:03:12,440
these images in here.

59
00:03:12,440 --> 00:03:15,410
And let's see how that looks.

60
00:03:15,410 --> 00:03:19,010
Let's do first, Let's make it around 1 second.

61
00:03:19,010 --> 00:03:25,740
See how that looks. Okay, that looks good enough for me.

62
00:03:25,735 --> 00:03:27,675
Save that.

63
00:03:27,670 --> 00:03:31,630
Let's call this the blood.

64
00:03:31,630 --> 00:03:33,670
And let's change all the images and

65
00:03:33,670 --> 00:03:36,210
make them no point filter apply.

66
00:03:36,205 --> 00:03:39,285
So the images should be sharper right now.

67
00:03:39,280 --> 00:03:41,290
And let's watch that again.

68
00:03:41,290 --> 00:03:42,760
Not too sharp.

69
00:03:42,760 --> 00:03:46,810
I would have rather making it a bit more sharpen that

70
00:03:46,810 --> 00:03:51,970
maybe we can change the one to 50 apply.

71
00:03:51,970 --> 00:03:54,700
Now they shouldn't be become much bigger.

72
00:03:54,700 --> 00:03:56,530
The extrude with width.

73
00:03:56,530 --> 00:04:01,410
Okay, so let's see what's the problem in here.

74
00:04:01,405 --> 00:04:04,645
Clear that, okay, so now we have the blood

75
00:04:04,640 --> 00:04:08,950
splashing all over soon as we start.

76
00:04:08,945 --> 00:04:11,275
And what I'm going to do is I'm going

77
00:04:11,270 --> 00:04:14,170
to add also a canvas and here.

78
00:04:14,165 --> 00:04:18,595
So what's the campus group that was called

79
00:04:18,590 --> 00:04:20,780
Canvas groups or now we can

80
00:04:20,780 --> 00:04:23,900
adjust the Alpha and we can block the re-cast.

81
00:04:23,900 --> 00:04:25,730
That's not a bad idea.

82
00:04:25,730 --> 00:04:27,760
We won't make it interactable.

83
00:04:27,755 --> 00:04:30,955
And now I also want to go ahead and maybe

84
00:04:30,950 --> 00:04:34,550
move the blood a little bit down,

85
00:04:34,550 --> 00:04:36,380
maybe rotate it a little bit.

86
00:04:36,380 --> 00:04:37,670
So now there we go.

87
00:04:37,670 --> 00:04:39,460
This is the blood that will appear.

88
00:04:39,455 --> 00:04:42,715
And honestly I feel that this is not really looking

89
00:04:42,710 --> 00:04:44,380
good because it's kind of

90
00:04:44,375 --> 00:04:46,745
grainy because we made it bigger.

91
00:04:46,745 --> 00:04:49,375
I think we might remove it later on,

92
00:04:49,370 --> 00:04:52,550
but for now let's just add a text Mesh problem here.

93
00:04:52,550 --> 00:04:55,490
Text Mesh probe and

94
00:04:55,490 --> 00:05:03,850
you die or capital.

95
00:05:03,845 --> 00:05:07,205
And make it bold.

96
00:05:07,205 --> 00:05:09,905
Let's see how that looks.

97
00:05:09,905 --> 00:05:13,695
Let's make it a bit bigger and auto size.

98
00:05:13,699 --> 00:05:17,109
And let's set it in the middle.

99
00:05:17,104 --> 00:05:19,794
And we can see that the max size in here,

100
00:05:19,790 --> 00:05:21,200
we can make it even bigger.

101
00:05:21,200 --> 00:05:23,200
So there we go, You died.

102
00:05:23,195 --> 00:05:25,405
Let's choose a different font,

103
00:05:25,400 --> 00:05:28,000
which is the one about the robot.

104
00:05:27,995 --> 00:05:32,495
Let's change the color of it to make it red.

105
00:05:32,495 --> 00:05:33,715
Let's move it up.

106
00:05:33,710 --> 00:05:35,210
Let's see how that looks.

107
00:05:35,210 --> 00:05:36,890
It doesn't look too good because

108
00:05:36,890 --> 00:05:38,300
of the outline that we have.

109
00:05:38,300 --> 00:05:42,920
So we are going to change the outline to

110
00:05:42,920 --> 00:05:45,410
be maybe also read or

111
00:05:45,410 --> 00:05:48,040
maybe just remove the outline completely.

112
00:05:48,035 --> 00:05:50,195
So there we go without any outline.

113
00:05:50,195 --> 00:05:51,955
Okay, that looks good.

114
00:05:51,950 --> 00:05:53,530
So you died.

115
00:05:53,525 --> 00:05:56,245
Okay, so if you've ever played Dark Souls,

116
00:05:56,240 --> 00:06:00,820
you know the reference and the, Let's continue on.

117
00:06:00,815 --> 00:06:03,415
So I think this is big enough.

118
00:06:03,410 --> 00:06:07,390
So now when the Lord lays, there we go.

119
00:06:07,385 --> 00:06:09,295
We can see we get the blood

120
00:06:09,290 --> 00:06:11,590
and we get the you died on the screen.

121
00:06:11,585 --> 00:06:14,995
So this tells us that the player just dive.

122
00:06:14,990 --> 00:06:17,000
Anyways, let's continue on now we

123
00:06:17,000 --> 00:06:19,010
need to actually turn this on and off.

124
00:06:19,010 --> 00:06:21,200
So what we're going to do is we're always

125
00:06:21,200 --> 00:06:24,100
going to keep the death screen off.

126
00:06:24,095 --> 00:06:26,125
So as long as the player is alive that

127
00:06:26,120 --> 00:06:28,330
that screen is off and when he dies,

128
00:06:28,325 --> 00:06:30,895
then we turn the screen on.

129
00:06:30,890 --> 00:06:33,910
So let's go into the UI Manager.

130
00:06:33,905 --> 00:06:37,465
And obviously we'll be changing the alpha on here also.

131
00:06:37,460 --> 00:06:39,080
We don't want it to just appear.

132
00:06:39,080 --> 00:06:41,350
We will make it slow will appear.

133
00:06:41,345 --> 00:06:43,765
And for that, we are going to also create

134
00:06:43,760 --> 00:06:47,180
an animation in here and screen blood.

135
00:06:47,180 --> 00:06:51,980
Let's call this the screen.

136
00:06:51,980 --> 00:06:53,710
Appear.

137
00:06:53,705 --> 00:06:55,315
Save that.

138
00:06:55,310 --> 00:06:58,720
And let's change this to take

139
00:06:58,715 --> 00:07:02,615
around 0.3 seconds and put it to one.

140
00:07:02,615 --> 00:07:06,365
So this is sort of the, you need to turn it on.

141
00:07:06,365 --> 00:07:09,265
And so this is sort of what happens.

142
00:07:09,260 --> 00:07:12,560
So we turn on the screen, it's starts playing.

143
00:07:12,560 --> 00:07:14,870
And there we go. And I'm going to just move

144
00:07:14,870 --> 00:07:17,440
the blood animation to

145
00:07:17,435 --> 00:07:20,245
when the death screen is completely dark.

146
00:07:20,240 --> 00:07:21,410
So we start the animation,

147
00:07:21,410 --> 00:07:23,270
there is nothing and then

148
00:07:23,270 --> 00:07:25,700
the block should appear later on.

149
00:07:25,700 --> 00:07:29,780
And actually we can go ahead and select this in

150
00:07:29,780 --> 00:07:33,820
here and just have an empty sprite.

151
00:07:33,815 --> 00:07:36,005
So we start off empty.

152
00:07:36,005 --> 00:07:38,165
Let's just see how that looks.

153
00:07:38,165 --> 00:07:42,395
And I'm going to turn this on completely. So there we go.

154
00:07:42,395 --> 00:07:43,325
Nope.

155
00:07:43,325 --> 00:07:45,845
The blood run this.

156
00:07:45,845 --> 00:07:48,275
There we go. And then we get the blood appearing.

157
00:07:48,275 --> 00:07:49,675
Okay, Excellent.

158
00:07:49,670 --> 00:07:53,420
I think this is going to look really nice.

159
00:07:53,420 --> 00:07:56,110
So save all of that back to the desk screen,

160
00:07:56,105 --> 00:07:59,735
set it to 0, turn the screen off, save all of that.

161
00:07:59,735 --> 00:08:02,425
And now let's go into our scripts.

162
00:08:02,420 --> 00:08:04,070
And in the UI Manager,

163
00:08:04,070 --> 00:08:05,590
I'm going to go ahead and get

164
00:08:05,585 --> 00:08:08,305
a reference to this, that screen.

165
00:08:08,300 --> 00:08:11,060
So serialized field, it's a game object

166
00:08:11,060 --> 00:08:13,930
and it's going to be the death screen.

167
00:08:13,925 --> 00:08:16,165
And now we are going to go ahead and create

168
00:08:16,160 --> 00:08:18,950
a method that will allow us to turn it on.

169
00:08:18,950 --> 00:08:21,460
So it's going to be a challenge.

170
00:08:21,455 --> 00:08:24,775
And your challenge is to activate the depth screen.

171
00:08:24,770 --> 00:08:26,320
Well, when we die.

172
00:08:26,315 --> 00:08:28,315
So you'll need to create a method that

173
00:08:28,310 --> 00:08:30,370
sets the death screen to active.

174
00:08:30,365 --> 00:08:32,395
And then you'll need to call the methods,

175
00:08:32,390 --> 00:08:35,150
method when the player dies.

176
00:08:35,150 --> 00:08:38,390
So to create that method and do I manager and then call

177
00:08:38,390 --> 00:08:41,900
it from the player health handled with that said,

178
00:08:41,900 --> 00:08:46,180
pause the video right now and go do the challenge.

179
00:08:46,175 --> 00:08:48,145
Okay, welcome back.

180
00:08:48,140 --> 00:08:50,360
So in here in the UI Manager,

181
00:08:50,360 --> 00:08:54,250
I'm going to create a public void.

182
00:08:54,245 --> 00:08:59,315
Turn death screen on.

183
00:08:59,315 --> 00:09:01,555
And all that it will do is just get

184
00:09:01,550 --> 00:09:06,680
the death screen and set active to true.

185
00:09:06,680 --> 00:09:08,170
And that's all.

186
00:09:08,165 --> 00:09:11,635
And then we'll go back and do the player handler and

187
00:09:11,630 --> 00:09:15,170
end here after we turn off the game object of the player,

188
00:09:15,170 --> 00:09:17,860
we are going to access the UI Manager.

189
00:09:17,855 --> 00:09:19,925
Or before we do that in here,

190
00:09:19,925 --> 00:09:22,675
the UI Manager Instance,

191
00:09:22,670 --> 00:09:27,590
deaf, turn death screen on. And there we go.

192
00:09:27,590 --> 00:09:31,130
So now we're going to start our game.

193
00:09:31,130 --> 00:09:34,280
Let's go to the game, make this bigger.

194
00:09:34,280 --> 00:09:37,160
Let's go to the DOM player will set his health

195
00:09:37,160 --> 00:09:40,760
to be 100. Run the game.

196
00:09:40,760 --> 00:09:45,020
So now when we get hit once,

197
00:09:45,019 --> 00:09:46,609
there we go, nothing happened,

198
00:09:46,610 --> 00:09:50,740
obviously because every single time I have to forget to,

199
00:09:50,735 --> 00:09:52,595
you know, where this is going.

200
00:09:52,595 --> 00:09:54,595
We forgot to add a reference.

201
00:09:54,590 --> 00:09:55,490
Excellent.

202
00:09:55,490 --> 00:09:57,590
Now we save, now we run.

203
00:09:57,590 --> 00:10:01,910
Now we should have everything working. There we go.

204
00:10:01,910 --> 00:10:05,090
We get shot once, twice, you died.

205
00:10:05,090 --> 00:10:06,860
And obviously we also

206
00:10:06,860 --> 00:10:09,530
forget the thing that we always forget.

207
00:10:09,530 --> 00:10:12,790
So animations, where is it?

208
00:10:12,785 --> 00:10:15,715
The blood?

209
00:10:15,710 --> 00:10:17,370
The blood or death?

210
00:10:17,370 --> 00:10:18,800
The death.

211
00:10:18,800 --> 00:10:21,770
Okay, remove the animation. Remove the animation.

212
00:10:21,770 --> 00:10:24,710
Save that from the game for the third time, please.

213
00:10:24,710 --> 00:10:26,230
No more errors.

214
00:10:26,225 --> 00:10:30,575
And now we get shot once, twice, we die.

215
00:10:30,575 --> 00:10:32,945
Nice. How cool is that?

216
00:10:32,945 --> 00:10:35,965
But obviously there is the one problem that

217
00:10:35,960 --> 00:10:39,230
still prevailing and that is the flying saucer.

218
00:10:39,230 --> 00:10:40,910
So what we're going to do is

219
00:10:40,910 --> 00:10:42,850
we're going to make sure that the enemy can

220
00:10:42,845 --> 00:10:47,735
only should sort or should whatever projectile he has.

221
00:10:47,735 --> 00:10:52,205
Only when we are visible or when we are in the game.

222
00:10:52,205 --> 00:10:56,755
So I'm going to go into the NMI controller and here,

223
00:10:56,750 --> 00:11:00,520
and I'm going to scroll down and find where we are

224
00:11:00,515 --> 00:11:04,075
instantiating the bullet or the projectile.

225
00:11:04,070 --> 00:11:05,720
So there we go in here.

226
00:11:05,720 --> 00:11:08,440
And the enemy fire

227
00:11:08,435 --> 00:11:11,315
and the Colton here we are instantiating this.

228
00:11:11,315 --> 00:11:13,495
So what I'm going to do is I'm going

229
00:11:13,490 --> 00:11:17,600
to create a condition in here that checks if the player

230
00:11:17,600 --> 00:11:23,840
to chase dot is dot game object out.

231
00:11:23,840 --> 00:11:25,700
So this is player chase range.

232
00:11:25,700 --> 00:11:30,380
So the player to chase dot is okay.

233
00:11:30,380 --> 00:11:32,740
So game object dot is,

234
00:11:32,735 --> 00:11:38,135
dot is active or active and hierarchy.

235
00:11:38,135 --> 00:11:41,675
Then we are going to shoot.

236
00:11:42,640 --> 00:11:45,470
If not, then we are not.

237
00:11:45,470 --> 00:11:47,120
So this active and hierarchy

238
00:11:47,120 --> 00:11:49,970
defines whether the game object is active in the scene.

239
00:11:49,970 --> 00:11:51,770
So what we're doing is we're turning

240
00:11:51,770 --> 00:11:54,250
off the player when we die.

241
00:11:54,245 --> 00:11:56,335
That means that he is no longer active.

242
00:11:56,330 --> 00:11:59,620
And the hierarchy, that means that we no longer

243
00:11:59,615 --> 00:12:01,975
instantiate the projectile of the enemy

244
00:12:01,970 --> 00:12:04,090
and we shouldn't get any errors.

245
00:12:04,085 --> 00:12:07,865
So let's try this one more time. Run the game.

246
00:12:07,865 --> 00:12:10,985
And let's see, we get sharp once,

247
00:12:10,985 --> 00:12:13,135
twice. Okay, You died.

248
00:12:13,130 --> 00:12:14,350
There we go.

249
00:12:14,345 --> 00:12:16,285
We can see that we no longer have

250
00:12:16,280 --> 00:12:19,310
any errors and the enemies don't instantiate anything.

251
00:12:19,310 --> 00:12:22,640
And if I zoom in to where is it?

252
00:12:22,640 --> 00:12:24,770
The doom, right here, okay,

253
00:12:24,770 --> 00:12:26,020
So we can't see anything,

254
00:12:26,015 --> 00:12:27,655
but you can see that we are

255
00:12:27,650 --> 00:12:29,200
no longer instantiating anything.

256
00:12:29,195 --> 00:12:32,035
Let's run this again because I believed that I

257
00:12:32,030 --> 00:12:35,180
saw something right here when we got shot.

258
00:12:35,180 --> 00:12:36,620
Oh, okay. Okay.

259
00:12:36,620 --> 00:12:38,470
No, everything is good.

260
00:12:38,465 --> 00:12:41,725
So there we go. We have our death screen.

261
00:12:41,720 --> 00:12:43,330
We no longer have

262
00:12:43,325 --> 00:12:45,625
the projectiles and instantiating

263
00:12:45,620 --> 00:12:47,320
whenever our player dies,

264
00:12:47,315 --> 00:12:49,435
let's make sure we apply the changes.

265
00:12:49,430 --> 00:12:52,700
We make sure that we commit our changes,

266
00:12:52,699 --> 00:12:54,889
and we make sure that we leave a review for

267
00:12:54,890 --> 00:12:57,430
Michael because it helps him out a lot.

268
00:12:57,425 --> 00:12:59,915
In the next video, we are of course,

269
00:12:59,915 --> 00:13:01,415
if you are enjoying the video,

270
00:13:01,415 --> 00:13:04,075
obviously, anyways, in the next video,

271
00:13:04,070 --> 00:13:07,960
we are going to create the mechanic of making the player

272
00:13:07,955 --> 00:13:10,015
a bit invincible whenever he gets

273
00:13:10,010 --> 00:13:12,110
it for just a temporary time.

274
00:13:12,110 --> 00:13:14,060
So that said, I hope you enjoy

275
00:13:14,060 --> 00:13:17,190
and I'll see you in the next one.

