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

2
00:00:03,030 --> 00:00:04,410
to a brand new video.

3
00:00:04,410 --> 00:00:07,650
And in this one we are going
to do a couple of things.

4
00:00:07,650 --> 00:00:10,970
First of all, we've added
a cinema machine combiner.

5
00:00:10,965 --> 00:00:11,825
What is that?

6
00:00:11,820 --> 00:00:15,330
That means that our camera no
longer goes out of bounds.

7
00:00:15,330 --> 00:00:17,150
It's movement is a bit weird,

8
00:00:17,145 --> 00:00:19,595
but because we didn't give
it enough time, remember,

9
00:00:19,590 --> 00:00:20,850
we could see the blue lines and

10
00:00:20,850 --> 00:00:22,430
here we no longer see them.

11
00:00:22,425 --> 00:00:25,775
And now when we move
through the portal, Whoa,

12
00:00:25,770 --> 00:00:26,850
you can see that we move in

13
00:00:26,850 --> 00:00:29,490
slow motion and then we
go to the next level.

14
00:00:29,490 --> 00:00:31,460
So there is a bit of

15
00:00:31,455 --> 00:00:34,995
delay and the time
scale of our world.

16
00:00:34,995 --> 00:00:37,215
So let's not waste
any more time.

17
00:00:37,215 --> 00:00:39,625
And let's get started.

18
00:00:39,625 --> 00:00:43,385
Oh, okay, So now
it's time to make

19
00:00:43,385 --> 00:00:47,335
our transitions just a
little bit more cool.

20
00:00:47,330 --> 00:00:50,690
And first thing I want
to do is I want to

21
00:00:50,690 --> 00:00:54,220
go into the console and see
this message right here.

22
00:00:54,215 --> 00:00:56,665
And I'm just going
to delete this.

23
00:00:56,660 --> 00:00:57,710
We don't need it anymore.

24
00:00:57,710 --> 00:01:00,140
This was just for
debugging purposes.

25
00:01:00,140 --> 00:01:02,930
And whenever you have
some kind of error or

26
00:01:02,930 --> 00:01:06,050
you're not sure of something,

27
00:01:06,050 --> 00:01:08,090
use debug dot log at helps out

28
00:01:08,090 --> 00:01:10,610
a lot just to see if some
condition is working.

29
00:01:10,610 --> 00:01:12,590
Some condition is not whether

30
00:01:12,590 --> 00:01:13,940
the amount of enemies it

31
00:01:13,940 --> 00:01:15,670
has finished and so
on and so forth.

32
00:01:15,665 --> 00:01:18,925
So debug dot log
is best, amazing.

33
00:01:18,920 --> 00:01:21,470
It saved my behind
so many times.

34
00:01:21,470 --> 00:01:23,090
So let's continue one,

35
00:01:23,090 --> 00:01:24,380
what do we want to do in here?

36
00:01:24,380 --> 00:01:26,030
Well, first thing we want to

37
00:01:26,030 --> 00:01:28,870
do is once we go
through the portal.

38
00:01:28,865 --> 00:01:30,865
So when we go to the portal,

39
00:01:30,860 --> 00:01:33,670
we don't want to have our
player just running around

40
00:01:33,665 --> 00:01:36,785
like a crazy maniac
after he enters there,

41
00:01:36,785 --> 00:01:38,725
we want to actually stop him and

42
00:01:38,720 --> 00:01:41,050
make him just wait a
couple of seconds.

43
00:01:41,045 --> 00:01:41,995
Weight.

44
00:01:41,990 --> 00:01:43,750
So there's a difference.

45
00:01:43,745 --> 00:01:46,415
Do we want to completely
stop the player?

46
00:01:46,415 --> 00:01:49,025
Or we can do something
even better?

47
00:01:49,025 --> 00:01:53,635
And we can actually slow down
the time in which moves,

48
00:01:53,630 --> 00:01:56,450
so his movement will
become much slow.

49
00:01:56,450 --> 00:01:57,460
How about that?

50
00:01:57,455 --> 00:01:59,195
I think it's a better solution.

51
00:01:59,195 --> 00:02:02,795
So I'm going to open
up the level manager.

52
00:02:02,795 --> 00:02:06,185
And in here after we start
loading the next level,

53
00:02:06,185 --> 00:02:07,855
what I'm going to
do is I'm going to

54
00:02:07,850 --> 00:02:10,250
access the time and I'm going

55
00:02:10,250 --> 00:02:14,800
to access the time
scale on the world.

56
00:02:14,795 --> 00:02:17,525
And you can see right here
what is the timescale?

57
00:02:17,525 --> 00:02:20,185
It's the scale at
which time passes.

58
00:02:20,180 --> 00:02:23,680
So currently the time passes
normally in our game,

59
00:02:23,675 --> 00:02:28,455
what I'll do is I'll
change this to 0.2.

60
00:02:28,455 --> 00:02:31,275
So now it will be running at the

61
00:02:31,270 --> 00:02:34,140
20% of its original speed.

62
00:02:34,135 --> 00:02:36,595
And let's see how that looks.

63
00:02:36,595 --> 00:02:38,715
I don't recommend that
you do this all the time

64
00:02:38,710 --> 00:02:41,320
because not only does
the game slow down,

65
00:02:41,320 --> 00:02:43,030
but everything slows down,

66
00:02:43,030 --> 00:02:44,700
so even the animation.

67
00:02:44,695 --> 00:02:47,245
So I'm going to run,

68
00:02:47,245 --> 00:02:51,865
I'm going to enter the portal
and you'll notice that now,

69
00:02:51,865 --> 00:02:54,265
whoa, how cool is that?

70
00:02:54,265 --> 00:02:56,535
The gun is still pointing
correctly, obviously,

71
00:02:56,530 --> 00:02:59,590
but the animation
is much slower.

72
00:02:59,590 --> 00:03:01,720
So there you go,
Michael Jackson.

73
00:03:01,719 --> 00:03:04,019
And we are at level two.

74
00:03:04,015 --> 00:03:07,555
Very nice, but we
are still moving.

75
00:03:07,555 --> 00:03:09,075
Oh, and look at the bullets.

76
00:03:09,070 --> 00:03:11,310
But the bullets, how
cool is this bullets?

77
00:03:11,310 --> 00:03:14,510
I recommend that you
remember this and

78
00:03:14,510 --> 00:03:17,720
you added a some kind of
mechanic into your game.

79
00:03:17,720 --> 00:03:21,560
So everything slows
down and let me

80
00:03:21,560 --> 00:03:23,270
just shoot a couple of

81
00:03:23,270 --> 00:03:26,600
bullets and get the
hell away from there.

82
00:03:26,600 --> 00:03:29,140
How cool is that? Seriously?

83
00:03:29,135 --> 00:03:31,445
Not tell me that's
not really cool.

84
00:03:31,445 --> 00:03:35,095
So now what we want to do
is we want to go back.

85
00:03:35,090 --> 00:03:37,250
So as you saw from level 2,

86
00:03:37,250 --> 00:03:39,170
we are moving in slow motion,

87
00:03:39,170 --> 00:03:41,000
but when we go to level 1,

88
00:03:41,000 --> 00:03:45,130
we are back at this
really bad timing.

89
00:03:45,125 --> 00:03:50,065
So what we do is we are going
to issue this challenge.

90
00:03:50,060 --> 00:03:52,480
We set the scale back.

91
00:03:52,475 --> 00:03:54,415
So obviously we don't want

92
00:03:54,410 --> 00:03:56,540
to have the timescale like this.

93
00:03:56,540 --> 00:03:58,580
So find where we need to set

94
00:03:58,580 --> 00:04:01,390
the time-scale back
to its original form.

95
00:04:01,385 --> 00:04:04,345
And I will give you a
hint of what or how to

96
00:04:04,340 --> 00:04:07,430
set it back to its original
form to return to normal,

97
00:04:07,430 --> 00:04:09,340
set the time-scale back to 1.

98
00:04:09,335 --> 00:04:13,115
A-flat means it's 100% not 0.1,

99
00:04:13,115 --> 00:04:14,675
or you can make it even faster.

100
00:04:14,675 --> 00:04:16,355
Does that out enjoy, have fun.

101
00:04:16,355 --> 00:04:20,065
Make sure to turn back the
scale to its original form.

102
00:04:20,060 --> 00:04:21,250
Where should we do that?

103
00:04:21,245 --> 00:04:26,045
Pause the video right now
and go do the challenge.

104
00:04:26,110 --> 00:04:28,330
Okay, welcome back.

105
00:04:28,325 --> 00:04:30,695
I hope you figure that out.

106
00:04:30,695 --> 00:04:32,135
Where should we do that?

107
00:04:32,135 --> 00:04:34,325
Well, we start the timescale.

108
00:04:34,325 --> 00:04:35,815
We wait for two seconds,

109
00:04:35,810 --> 00:04:37,520
and then after we finish,

110
00:04:37,520 --> 00:04:39,860
before we load, the next scene,

111
00:04:39,860 --> 00:04:43,960
will access the
time dot timescale

112
00:04:43,955 --> 00:04:49,765
and sell it back to one f.
Say that back in our game.

113
00:04:49,760 --> 00:04:55,000
From the game, go up,
go through portal,

114
00:04:54,995 --> 00:04:57,535
and do not something
that now it takes

115
00:04:57,530 --> 00:05:00,850
more than two seconds
to load level. So one.

116
00:05:00,845 --> 00:05:02,215
Two, Why is that?

117
00:05:02,210 --> 00:05:05,090
Well, because timescale
is slowed down.

118
00:05:05,090 --> 00:05:05,950
There we go.

119
00:05:05,945 --> 00:05:09,245
So now we are back here and
everything is working fine.

120
00:05:09,245 --> 00:05:11,425
So the final thing
that we need to

121
00:05:11,420 --> 00:05:13,550
fix is the fact that we have to

122
00:05:13,550 --> 00:05:17,870
wait so long for the level
to load. Why is that?

123
00:05:17,870 --> 00:05:19,700
Well, obviously
because here we are

124
00:05:19,700 --> 00:05:21,830
waiting for seconds,
the time to load,

125
00:05:21,830 --> 00:05:23,420
but before we do that,

126
00:05:23,420 --> 00:05:26,480
the timescale has
been set to be 0.2,

127
00:05:26,480 --> 00:05:29,000
so 20 percent of
the original time.

128
00:05:29,000 --> 00:05:31,060
How are we going to fix this?

129
00:05:31,055 --> 00:05:33,295
Well, fortunately, there is

130
00:05:33,290 --> 00:05:35,060
something really nice and here,

131
00:05:35,060 --> 00:05:37,760
really convenient that
says that we have to

132
00:05:37,760 --> 00:05:42,290
wait for seconds in real time.

133
00:05:42,290 --> 00:05:44,780
So this spends the
court in execution to

134
00:05:44,780 --> 00:05:48,410
a given amount of second
using unskilled time.

135
00:05:48,410 --> 00:05:51,830
Can you read this? Is I think
we should make it bigger.

136
00:05:51,830 --> 00:05:53,960
No, unskilled time.

137
00:05:53,960 --> 00:05:56,780
So wait for where is it?

138
00:05:56,780 --> 00:06:00,250
Wait four seconds in
real time, we save that.

139
00:06:00,245 --> 00:06:02,215
And now the co-routine is no

140
00:06:02,210 --> 00:06:04,410
longer affected
by the timescale.

141
00:06:04,405 --> 00:06:06,635
So now let's just test this out.

142
00:06:06,635 --> 00:06:08,095
Run, run, run, run, get to this

143
00:06:08,090 --> 00:06:13,100
112 and we are in the level one.

144
00:06:13,100 --> 00:06:14,050
Really nice.

145
00:06:14,045 --> 00:06:15,005
I hope you enjoy it.

146
00:06:15,005 --> 00:06:16,345
I hope you're having fun.

147
00:06:16,340 --> 00:06:18,890
And let's see, we have
still a couple of minutes.

148
00:06:18,890 --> 00:06:20,570
It's a very short video.

149
00:06:20,570 --> 00:06:22,660
There is something that
I wanted to address.

150
00:06:22,655 --> 00:06:24,865
So in here when we run the game,

151
00:06:24,860 --> 00:06:27,860
actually let's make this a
bit bigger so we can see.

152
00:06:27,860 --> 00:06:29,300
So now we walk around,

153
00:06:29,300 --> 00:06:30,650
OK, so everything is black.

154
00:06:30,650 --> 00:06:32,810
We feel that we are
in the game properly,

155
00:06:32,810 --> 00:06:35,030
but we see this blue right here,

156
00:06:35,030 --> 00:06:36,200
and I don't like it.

157
00:06:36,200 --> 00:06:39,590
Now, we could cover this with
a couple of black boils.

158
00:06:39,590 --> 00:06:41,330
That would be a good solution,

159
00:06:41,330 --> 00:06:42,920
not a bad one, of course,

160
00:06:42,920 --> 00:06:45,800
but there is a much
better way and a property

161
00:06:45,800 --> 00:06:47,540
inside of Cinema machine that

162
00:06:47,540 --> 00:06:49,400
we are going to
take advantage of,

163
00:06:49,400 --> 00:06:51,280
and that is the confinement.

164
00:06:51,275 --> 00:06:53,975
So I'm going to make
the scene a bit bigger.

165
00:06:53,975 --> 00:06:55,655
I'm going to zoom out.

166
00:06:55,655 --> 00:06:59,185
And if I click on the
virtual camera right here,

167
00:06:59,180 --> 00:07:01,340
you can see down
here that we have

168
00:07:01,340 --> 00:07:05,120
something that
says, where is it?

169
00:07:05,120 --> 00:07:07,070
Okay, so there we go,

170
00:07:07,070 --> 00:07:09,700
Add Extension Center
machine confined,

171
00:07:09,695 --> 00:07:12,745
and it creates an additional
component in here.

172
00:07:12,740 --> 00:07:15,830
And you can see that we
have the bounding shape and

173
00:07:15,830 --> 00:07:17,930
the bounding shape
is required and it

174
00:07:17,930 --> 00:07:20,620
should be a polygon collider.

175
00:07:20,615 --> 00:07:21,805
What is a polygon?

176
00:07:21,800 --> 00:07:25,150
Polygon means that just like
we have a circle, rectangle,

177
00:07:25,145 --> 00:07:27,025
triangle, polygon means that

178
00:07:27,020 --> 00:07:29,030
we can give whatever
shape we want.

179
00:07:29,030 --> 00:07:30,560
So what does this do?

180
00:07:30,560 --> 00:07:32,750
It adds a bound to the way

181
00:07:32,750 --> 00:07:35,360
the camera or how much
the camera can move.

182
00:07:35,360 --> 00:07:36,560
Let me explain.

183
00:07:36,560 --> 00:07:41,630
I'm going to go in the where
is it the grid naming?

184
00:07:41,630 --> 00:07:45,610
Right-click in here. I'm going
to add maybe a component.

185
00:07:45,605 --> 00:07:49,265
And let's go ahead
and call it the true

186
00:07:49,265 --> 00:07:53,455
because of the
polygon collider 2D.

187
00:07:53,450 --> 00:07:55,430
There we go. I can edit this.

188
00:07:55,430 --> 00:07:56,990
You can see this is the polygon,

189
00:07:56,990 --> 00:07:59,000
so we can, there we go.

190
00:07:59,000 --> 00:07:59,780
Make it like this.

191
00:07:59,780 --> 00:08:01,300
If you hold down Control,

192
00:08:01,295 --> 00:08:02,635
you can see this red line.

193
00:08:02,630 --> 00:08:04,550
This means that it
will be deleted.

194
00:08:04,550 --> 00:08:09,380
So I'm going to go ahead
and make the bounds for

195
00:08:09,380 --> 00:08:14,150
which our camera or the
machine camera is moving in,

196
00:08:14,150 --> 00:08:18,670
the bounds which it
does not go through.

197
00:08:18,665 --> 00:08:22,255
So I'm going to make sure that,

198
00:08:22,250 --> 00:08:24,460
for example, we cannot

199
00:08:24,455 --> 00:08:26,755
look right here and
look what we can do.

200
00:08:26,750 --> 00:08:29,260
Actually, we can
add another point.

201
00:08:29,255 --> 00:08:33,425
This is why we need a polygon
collider, and there we go.

202
00:08:33,425 --> 00:08:35,015
So the camera will not be

203
00:08:35,015 --> 00:08:37,015
able to go outside
these bonds and

204
00:08:37,010 --> 00:08:40,930
we will not be able to see
the blue in here. Can we?

205
00:08:40,925 --> 00:08:42,625
Does Michael tell the truth?

206
00:08:42,620 --> 00:08:43,370
Not always.

207
00:08:43,370 --> 00:08:46,070
That's run it again
and see for ourselves.

208
00:08:46,070 --> 00:08:50,090
So, Okay, I am outside
the bond because

209
00:08:50,090 --> 00:08:51,800
there's something very important

210
00:08:51,800 --> 00:08:53,950
and it needs to be a trigger.

211
00:08:53,945 --> 00:08:55,805
We don't want it to
affect anything.

212
00:08:55,805 --> 00:08:57,685
And even better if we can make

213
00:08:57,680 --> 00:08:59,630
this grid a different player.

214
00:08:59,630 --> 00:09:03,110
So I think we will have to
make it a different layer,

215
00:09:03,110 --> 00:09:05,680
yet we will have to make
it a different layer.

216
00:09:05,675 --> 00:09:10,445
So that's why I wanted to call
the grid the untouchable,

217
00:09:10,445 --> 00:09:12,115
call it the wrong layer.

218
00:09:12,110 --> 00:09:14,800
And the North this object only

219
00:09:14,795 --> 00:09:16,255
because it will affect

220
00:09:16,250 --> 00:09:17,960
only the polygon
we have the walls,

221
00:09:17,960 --> 00:09:22,130
we may want the walls to
interact with the player.

222
00:09:22,130 --> 00:09:23,390
So run the game,

223
00:09:23,390 --> 00:09:24,860
okay, with the bullets
of the players.

224
00:09:24,860 --> 00:09:25,310
There we go.

225
00:09:25,310 --> 00:09:27,290
Now we are not interacting.

226
00:09:27,290 --> 00:09:29,630
And if we go up here,

227
00:09:29,630 --> 00:09:31,250
we used to see the blue lines.

228
00:09:31,250 --> 00:09:34,070
Remember, we are still seeing

229
00:09:34,070 --> 00:09:35,480
the blue lines because he

230
00:09:35,480 --> 00:09:37,810
made one of the
biggest mistakes.

231
00:09:37,805 --> 00:09:41,425
We didn't even assign the
polygon collider right here.

232
00:09:41,420 --> 00:09:44,350
So drag the grid,
and there you go.

233
00:09:44,345 --> 00:09:47,645
Now we have the polygon
collider, run the game.

234
00:09:47,645 --> 00:09:50,185
We can show it around
and then we go.

235
00:09:50,180 --> 00:09:51,730
So Didn't I tell you?

236
00:09:51,725 --> 00:09:52,165
Okay.

237
00:09:52,160 --> 00:09:53,300
So as you can see,

238
00:09:53,300 --> 00:09:55,030
I can no longer oh,

239
00:09:55,025 --> 00:09:56,425
and look in the scene mode.

240
00:09:56,420 --> 00:09:59,030
You can see that now the camera

241
00:09:59,030 --> 00:10:03,380
moves only with how much the
confinement allows it to.

242
00:10:03,380 --> 00:10:05,960
So as soon as we hit one of
the others, There you go,

243
00:10:05,960 --> 00:10:08,660
the camera does not work
anymore and you can see it

244
00:10:08,660 --> 00:10:11,690
is forced to move
up through there.

245
00:10:11,690 --> 00:10:13,700
Very nice. So this is

246
00:10:13,700 --> 00:10:15,950
a very nifty trick
that you've learned.

247
00:10:15,950 --> 00:10:17,810
You can go down, as you can see,

248
00:10:17,810 --> 00:10:19,640
we can no longer
move the camera.

249
00:10:19,640 --> 00:10:20,660
Look where we are.

250
00:10:20,660 --> 00:10:22,490
We are no longer in
the center because

251
00:10:22,490 --> 00:10:25,010
the camera is
confined right here.

252
00:10:25,010 --> 00:10:26,540
It does not move.

253
00:10:26,540 --> 00:10:28,060
So I hope you enjoy it.

254
00:10:28,055 --> 00:10:29,525
I hope you like the strict.

255
00:10:29,525 --> 00:10:31,475
Obviously this
needs to be fixed.

256
00:10:31,475 --> 00:10:33,085
I don't like it at all.

257
00:10:33,080 --> 00:10:35,720
We need to change this polygon
collider a little bit.

258
00:10:35,720 --> 00:10:38,180
So maybe make it like that,

259
00:10:38,180 --> 00:10:39,790
Maybe this one like that.

260
00:10:39,785 --> 00:10:43,285
So it's always better to
have the shapes squared up.

261
00:10:43,280 --> 00:10:44,930
Make sure that you
look through this.

262
00:10:44,930 --> 00:10:46,580
Don't just do with nonchalantly,

263
00:10:46,580 --> 00:10:48,500
make sure that you take time to

264
00:10:48,500 --> 00:10:50,830
create the combiner properly.

265
00:10:50,825 --> 00:10:52,525
So that done, I hope you

266
00:10:52,520 --> 00:10:54,770
enjoyed the video
is enough length.

267
00:10:54,770 --> 00:10:56,960
There is still one thing
that we need to fix and

268
00:10:56,960 --> 00:10:59,540
that is the blood
animation on the enemies.

269
00:10:59,540 --> 00:11:01,790
So I'm going to
give you that task.

270
00:11:01,790 --> 00:11:04,940
So here this flash
animations at the end,

271
00:11:04,940 --> 00:11:06,770
we want to make sure
to destroy all of

272
00:11:06,770 --> 00:11:09,920
these blood that come off
the player, the enemy.

273
00:11:09,920 --> 00:11:11,620
We don't want to keep
them in the hierarchy.

274
00:11:11,615 --> 00:11:14,035
So with that done, I
hope you enjoy it.

275
00:11:14,030 --> 00:11:17,840
I hope you are staging
everything, stage all.

276
00:11:17,840 --> 00:11:20,150
What did we do in
this video changed

277
00:11:20,150 --> 00:11:23,200
the time scale and now

278
00:11:23,195 --> 00:11:30,335
it's much cooler
when transitioning.

279
00:11:30,335 --> 00:11:38,255
And made a cinema
machine. Gunfire.

280
00:11:38,255 --> 00:11:40,205
Commit the changes.

281
00:11:40,205 --> 00:11:41,975
Look at the master.

282
00:11:41,975 --> 00:11:43,615
Appreciate your work.

283
00:11:43,610 --> 00:11:45,280
Enjoy how far you've come,

284
00:11:45,275 --> 00:11:48,365
and I'll see you
in the next video.

