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

2
00:00:03,525 --> 00:00:07,655
This video will be a bit longer because this is

3
00:00:07,650 --> 00:00:09,300
one of the times that I

4
00:00:09,300 --> 00:00:12,060
really wasn't sure what we are going to make.

5
00:00:12,060 --> 00:00:14,100
So I wasn't sure if I wanted to make

6
00:00:14,100 --> 00:00:17,960
this a trigger or I wanted to make this a solid object.

7
00:00:17,955 --> 00:00:19,625
But anyways, when we walk through

8
00:00:19,620 --> 00:00:21,810
this, but nothing happens,

9
00:00:21,810 --> 00:00:23,220
but if we dashed through it,

10
00:00:23,220 --> 00:00:25,710
you can see that we can break it. How cool is that?

11
00:00:25,710 --> 00:00:28,700
And it disappears on its own after a couple of seconds.

12
00:00:28,695 --> 00:00:30,495
So let's not waste any more time.

13
00:00:30,495 --> 00:00:33,035
Make sure to put your concentration SCAP on.

14
00:00:33,030 --> 00:00:35,360
I do have teeny tiny mistakes

15
00:00:35,355 --> 00:00:37,355
and some hesitations during this,

16
00:00:37,350 --> 00:00:39,140
but don't worry, I explained

17
00:00:39,135 --> 00:00:41,295
everything as much as possible.

18
00:00:41,295 --> 00:00:44,175
So Let's get started.

19
00:00:44,170 --> 00:00:47,650
Oh, okay, So now it's

20
00:00:47,650 --> 00:00:51,150
time to add a couple of breakable objects.

21
00:00:51,145 --> 00:00:53,245
This is the whole point of the section.

22
00:00:53,245 --> 00:00:55,245
We're at the second video and we

23
00:00:55,240 --> 00:00:57,790
still haven't added anything to destroy.

24
00:00:57,790 --> 00:01:01,840
So I'm going to go into my sprites in here.

25
00:01:01,840 --> 00:01:04,990
And I'm going to make this slightly bigger.

26
00:01:04,990 --> 00:01:07,980
On this way. I guess we can even

27
00:01:07,975 --> 00:01:11,305
make these icons are a bit smaller so they fit nicely.

28
00:01:11,305 --> 00:01:12,495
There we go. So I'm going to

29
00:01:12,490 --> 00:01:14,710
right-click create a new folder,

30
00:01:14,710 --> 00:01:18,030
and this will be the breakable objects.

31
00:01:18,025 --> 00:01:21,055
Breakable objects,

32
00:01:21,055 --> 00:01:23,275
and this is why we always create folders.

33
00:01:23,275 --> 00:01:25,135
Imagine if we had all of

34
00:01:25,130 --> 00:01:27,710
the sprites altogether in a single folder,

35
00:01:27,710 --> 00:01:29,540
it would have been a nightmare.

36
00:01:29,540 --> 00:01:32,540
Anyways, we'll go into the resources,

37
00:01:32,540 --> 00:01:33,650
as you can see right here,

38
00:01:33,650 --> 00:01:36,080
we have many bots to destroy.

39
00:01:36,080 --> 00:01:39,190
I'm going to choose the right one.

40
00:01:39,185 --> 00:01:43,955
I'm going to choose the white breakable object.

41
00:01:43,954 --> 00:01:44,664
There we go.

42
00:01:44,660 --> 00:01:45,970
We sudden in here.

43
00:01:45,965 --> 00:01:48,205
And we can go ahead and dissect this.

44
00:01:48,200 --> 00:01:51,470
So I'm going to make sure that it's multiple.

45
00:01:51,470 --> 00:01:54,560
And I'm going to do this may be off

46
00:01:54,560 --> 00:01:57,350
screen and I will let you know when I finish.

47
00:01:57,350 --> 00:01:58,190
Okay.

48
00:01:58,190 --> 00:01:59,330
So welcome back.

49
00:01:59,330 --> 00:02:01,150
Let me tell you what I did.

50
00:02:01,145 --> 00:02:02,665
I didn't want to bore you with

51
00:02:02,660 --> 00:02:04,100
all the details, so all I did,

52
00:02:04,100 --> 00:02:07,130
I sliced up 32 by 32 the white box.

53
00:02:07,130 --> 00:02:09,350
We have three different parts here and

54
00:02:09,350 --> 00:02:11,570
three different breaks are used.

55
00:02:11,570 --> 00:02:16,490
The W1, W2, and W3 to describe the biggest pop breaking.

56
00:02:16,490 --> 00:02:17,960
And I make sure that we have

57
00:02:17,960 --> 00:02:19,820
these little three pieces in here.

58
00:02:19,820 --> 00:02:22,570
They will come in handy later on.

59
00:02:22,565 --> 00:02:24,385
So I'm going to discard any changes.

60
00:02:24,380 --> 00:02:27,230
I also created an animation for the bikeable parts.

61
00:02:27,230 --> 00:02:29,650
So there you go, you can see it breaks up.

62
00:02:29,645 --> 00:02:31,255
We're going to make sure from

63
00:02:31,250 --> 00:02:33,350
now that we go to the breakable.

64
00:02:33,350 --> 00:02:35,360
So you can see white bought breaking,

65
00:02:35,360 --> 00:02:36,910
make sure it doesn't loop.

66
00:02:36,905 --> 00:02:38,735
We are going to save all of that.

67
00:02:38,735 --> 00:02:40,255
Now the braking pot,

68
00:02:40,250 --> 00:02:42,560
I'm going to add a year

69
00:02:42,560 --> 00:02:45,440
Box Collider or a circular plus no,

70
00:02:45,440 --> 00:02:47,900
not a canvas. Remove the component.

71
00:02:47,900 --> 00:02:52,420
I'm going to add a box collider.

72
00:02:52,415 --> 00:02:55,135
So box collider 2D.

73
00:02:55,130 --> 00:02:56,660
There we go around this,

74
00:02:56,660 --> 00:02:59,350
I'm going to make it a bit smaller.

75
00:02:59,345 --> 00:03:03,535
I make the pixel size on the sprite.

76
00:03:03,530 --> 00:03:05,660
Let me show you what I did also.

77
00:03:05,660 --> 00:03:07,070
So you don't get confused.

78
00:03:07,070 --> 00:03:08,180
You can see that the pot is

79
00:03:08,180 --> 00:03:10,750
around a good size for the player.

80
00:03:10,745 --> 00:03:12,325
Let's keep it that way.

81
00:03:12,320 --> 00:03:16,250
And what we can do is we can go ahead and make it,

82
00:03:16,250 --> 00:03:17,930
well, this will depend on you.

83
00:03:17,930 --> 00:03:20,360
Do you want your object to be able to

84
00:03:20,360 --> 00:03:23,080
want us to be able to collide with this object,

85
00:03:23,075 --> 00:03:25,145
or we want to just make it a trigger.

86
00:03:25,145 --> 00:03:27,395
I'm going to keep it a trigger for now,

87
00:03:27,395 --> 00:03:29,335
later on, if you want to change this,

88
00:03:29,330 --> 00:03:31,910
if you want to have interactions with the pots,

89
00:03:31,910 --> 00:03:34,880
you want them to stop you from walking through them.

90
00:03:34,880 --> 00:03:37,750
Than I do recommend you make it non-trigger.

91
00:03:37,745 --> 00:03:40,145
Know what, Let's keep it as a non-trigger.

92
00:03:40,145 --> 00:03:42,295
And for that reason we're going to add

93
00:03:42,290 --> 00:03:46,690
a rigid body to it and we'll make it static.

94
00:03:46,685 --> 00:03:47,315
Okay?

95
00:03:47,315 --> 00:03:49,505
So it's a static. It does not move,

96
00:03:49,505 --> 00:03:51,605
but we can break it.

97
00:03:51,605 --> 00:03:54,655
So what else should we be doing in here?

98
00:03:54,650 --> 00:03:57,350
Well, I think that's it. For now.

99
00:03:57,350 --> 00:03:59,030
Let's save this and let's

100
00:03:59,030 --> 00:04:00,950
go ahead and add a script to it,

101
00:04:00,950 --> 00:04:03,490
which is going to be called the breakup bulls.

102
00:04:03,485 --> 00:04:06,065
So in the scripts,

103
00:04:06,065 --> 00:04:08,095
because we want to add behavior obviously

104
00:04:08,090 --> 00:04:10,790
to the spot we wanted to break.

105
00:04:10,790 --> 00:04:15,060
Come on, okay, so let's see enemies player UI,

106
00:04:15,064 --> 00:04:20,434
and let's go ahead and create a folder in here.

107
00:04:20,435 --> 00:04:24,505
And let's make it for the breakable.

108
00:04:24,500 --> 00:04:29,690
Break bubbles opens up right-click Create will probably

109
00:04:29,690 --> 00:04:31,880
not have a different script

110
00:04:31,880 --> 00:04:34,040
or another script, okay, so breakable.

111
00:04:34,040 --> 00:04:37,100
But the good thing about creating a folder and setting

112
00:04:37,100 --> 00:04:38,630
just one script in here

113
00:04:38,630 --> 00:04:40,400
that we can see it from the outside.

114
00:04:40,400 --> 00:04:41,920
So and scripts right here,

115
00:04:41,915 --> 00:04:43,505
we can go ahead and check the

116
00:04:43,505 --> 00:04:45,745
breakable so we can find it immediately.

117
00:04:45,740 --> 00:04:48,830
I'm going to add to the braking part. There we go.

118
00:04:48,830 --> 00:04:50,180
We have the break bubbles.

119
00:04:50,180 --> 00:04:51,860
Let's open this up in here.

120
00:04:51,860 --> 00:04:54,190
And what shall we be doing?

121
00:04:54,185 --> 00:04:57,605
Well, because we are not using a trigger,

122
00:04:57,605 --> 00:04:59,245
we're going to use something called

123
00:04:59,240 --> 00:05:02,110
the on collision enter.

124
00:05:02,105 --> 00:05:04,105
So there you can see on collision is when

125
00:05:04,100 --> 00:05:06,370
the colliders less rigid body has begun

126
00:05:06,365 --> 00:05:09,355
touching another collider or rigid body,

127
00:05:09,350 --> 00:05:11,830
and we'll make sure that it's 2D.

128
00:05:11,825 --> 00:05:14,635
So in here you can see that instead of other,

129
00:05:14,630 --> 00:05:16,090
we have the collision.

130
00:05:16,085 --> 00:05:18,665
So what we're going to do is we're going to check

131
00:05:18,665 --> 00:05:23,395
if the collision.com tag,

132
00:05:23,390 --> 00:05:26,390
does it have compared tag? Nope, it doesn't.

133
00:05:26,390 --> 00:05:27,490
Tag.

134
00:05:27,485 --> 00:05:31,955
Or we can access the collider.com tag.

135
00:05:31,955 --> 00:05:33,775
There we go. So now we have

136
00:05:33,770 --> 00:05:35,990
the collider of the collision.

137
00:05:35,990 --> 00:05:38,960
And we'll check if it's the player.

138
00:05:38,960 --> 00:05:41,360
And if it is, then we are going to

139
00:05:41,360 --> 00:05:44,030
destroy the game object.

140
00:05:44,030 --> 00:05:46,690
Excuse me, the game object.

141
00:05:46,685 --> 00:05:47,705
Save that.

142
00:05:47,705 --> 00:05:49,975
And we'll also go in here,

143
00:05:49,970 --> 00:05:51,910
check for the animator

144
00:05:51,905 --> 00:05:55,825
and see what kind of trigger it does.

145
00:05:55,820 --> 00:05:58,570
So we'll need to create an idol in here.

146
00:05:58,565 --> 00:06:02,795
So we'll go into the assets animations.

147
00:06:02,795 --> 00:06:04,135
Or is it, where is it?

148
00:06:04,130 --> 00:06:07,100
Where is it? Breakable?

149
00:06:07,100 --> 00:06:11,260
White part, idle.

150
00:06:11,260 --> 00:06:12,820
That means that it's not moving

151
00:06:12,820 --> 00:06:14,610
because obviously you can see we

152
00:06:14,605 --> 00:06:15,985
don't want to have it

153
00:06:15,985 --> 00:06:18,075
breaking as soon as we start the game,

154
00:06:18,070 --> 00:06:19,560
we want to keep it like that.

155
00:06:19,555 --> 00:06:22,345
So what we can do is right-click in here

156
00:06:22,345 --> 00:06:25,735
and set this as the default state. So there you go.

157
00:06:25,735 --> 00:06:28,125
And we'll add this right here.

158
00:06:28,120 --> 00:06:31,750
Create a transition which will have some kind of trigger,

159
00:06:31,750 --> 00:06:33,280
which is the break,

160
00:06:33,280 --> 00:06:35,650
Scott break for simplicity,

161
00:06:35,650 --> 00:06:39,910
no exit time, transition duration 0.

162
00:06:39,910 --> 00:06:43,390
And I'm going to go ahead and make it as the break.

163
00:06:43,390 --> 00:06:45,240
Then we'll go back in here.

164
00:06:45,235 --> 00:06:47,285
We are going to,

165
00:06:47,289 --> 00:06:50,189
because this is, this won't be too complicated.

166
00:06:50,185 --> 00:06:53,205
I'll just get the animator immediately.

167
00:06:53,200 --> 00:06:56,380
So in here I'm going to say if the collision

168
00:06:56,380 --> 00:06:59,440
as player before we destroy or actually,

169
00:06:59,440 --> 00:07:02,320
you know, we are going to remove this.

170
00:07:02,320 --> 00:07:05,740
I'm going to go ahead and get

171
00:07:05,740 --> 00:07:10,210
the component, the animator.

172
00:07:10,210 --> 00:07:20,500
And in tor dot set trigger and is going to be the rake.

173
00:07:20,500 --> 00:07:23,890
And I know it's a string reference and I didn't copy it,

174
00:07:23,890 --> 00:07:27,400
but I hope the break is easy to understand.

175
00:07:27,399 --> 00:07:31,839
And then I'm going to create a public void.

176
00:07:31,840 --> 00:07:33,940
Destroy.

177
00:07:33,940 --> 00:07:38,810
Well, no, destroy.

178
00:07:38,810 --> 00:07:41,530
Just, let's just call it destroys.

179
00:07:41,525 --> 00:07:45,115
And maybe we want to add some kind of

180
00:07:45,110 --> 00:07:48,950
cold in so we don't want the pot to be destroyed.

181
00:07:48,950 --> 00:07:51,620
So let me tell you what I'm looking in here to do.

182
00:07:51,620 --> 00:07:53,140
What without a coroutine,

183
00:07:53,135 --> 00:07:56,185
simply destroy the game object.

184
00:07:56,180 --> 00:07:57,860
What I wanted to say, I wanted to

185
00:07:57,860 --> 00:08:00,140
use a co-routine to delay

186
00:08:00,140 --> 00:08:05,680
the disappearance of the little pieces right here.

187
00:08:05,675 --> 00:08:08,635
But on the other hand, I thought it might be even better

188
00:08:08,630 --> 00:08:11,720
to just set this right here,

189
00:08:11,720 --> 00:08:15,380
called the event after maybe a couple of seconds,

190
00:08:15,380 --> 00:08:18,070
or we can choose maybe on second three,

191
00:08:18,065 --> 00:08:20,075
go, set the event.

192
00:08:20,075 --> 00:08:23,875
What's the function? Destroy, save that, run the game.

193
00:08:23,870 --> 00:08:25,250
So now we should see that as

194
00:08:25,250 --> 00:08:27,490
soon as we collide with the pot,

195
00:08:27,485 --> 00:08:30,075
then it gets destroyed.

196
00:08:30,079 --> 00:08:31,599
And there we go,

197
00:08:31,595 --> 00:08:33,535
the object has disappeared.

198
00:08:33,530 --> 00:08:35,900
And what we also can do is, for example,

199
00:08:35,900 --> 00:08:37,400
we can go in the animation of

200
00:08:37,400 --> 00:08:39,740
the braking part and the animation.

201
00:08:39,740 --> 00:08:42,970
So as soon as the pot breaks,

202
00:08:42,965 --> 00:08:45,095
Let's say it shatters right here.

203
00:08:45,095 --> 00:08:47,855
What we can do, we can start recording

204
00:08:47,855 --> 00:08:50,915
and then turn off the box collider.

205
00:08:50,915 --> 00:08:54,385
So you'll see that right now the box is good when you

206
00:08:54,380 --> 00:08:58,100
see the pot entirely and when it breaks, there we go.

207
00:08:58,100 --> 00:08:59,930
There is no more collider.

208
00:08:59,929 --> 00:09:01,449
And if we look closely,

209
00:09:01,445 --> 00:09:04,015
we can choose the collider and maybe move it a little

210
00:09:04,010 --> 00:09:06,650
bit before it actually breaks.

211
00:09:06,650 --> 00:09:09,710
So it seems as if we've walked through it.

212
00:09:09,710 --> 00:09:12,270
So save that. Run the game. Oh, no. Talk.

213
00:09:12,270 --> 00:09:13,100
No.

214
00:09:13,095 --> 00:09:14,545
Not like that.

215
00:09:14,540 --> 00:09:15,320
Sorry.

216
00:09:15,320 --> 00:09:17,510
Oh, so it record I

217
00:09:17,510 --> 00:09:20,140
forgot to press the right button. We run the game.

218
00:09:20,135 --> 00:09:21,935
We had the pot.

219
00:09:21,935 --> 00:09:23,135
There you go at breaks.

220
00:09:23,135 --> 00:09:25,675
So it feels really as if we walked

221
00:09:25,670 --> 00:09:28,430
through it and you can see the pop disappearing.

222
00:09:28,430 --> 00:09:29,290
Okay, great.

223
00:09:29,285 --> 00:09:30,475
So what that done,

224
00:09:30,470 --> 00:09:32,300
what we need to do is we need to make

225
00:09:32,300 --> 00:09:34,390
sure that this pot breaks,

226
00:09:34,385 --> 00:09:37,405
not when we are just walking through it,

227
00:09:37,400 --> 00:09:40,630
we want it to break when we actually dash through it.

228
00:09:40,625 --> 00:09:45,205
And I think that this is going to be a challenge for you.

229
00:09:45,200 --> 00:09:46,850
And your challenge is going to be to

230
00:09:46,850 --> 00:09:49,100
return a Boolean value.

231
00:09:49,100 --> 00:09:52,820
What I felt that was about breaking when we're running,

232
00:09:52,820 --> 00:09:55,180
well, when we are dashing,

233
00:09:55,175 --> 00:09:56,525
we want to create

234
00:09:56,525 --> 00:09:59,185
a method int player controller that

235
00:09:59,180 --> 00:10:02,020
we can access from the break we'll script.

236
00:10:02,015 --> 00:10:03,245
Why is that?

237
00:10:03,245 --> 00:10:05,515
Well, we'll need to create a method that

238
00:10:05,510 --> 00:10:08,300
returns a bool instead of a void.

239
00:10:08,300 --> 00:10:10,310
And that method should return

240
00:10:10,310 --> 00:10:12,880
true if we are dashing and false,

241
00:10:12,875 --> 00:10:16,805
if we are not and false if not,

242
00:10:16,805 --> 00:10:19,015
not, this is not w, it's steep.

243
00:10:19,010 --> 00:10:21,170
Hence, we will need to use the players,

244
00:10:21,170 --> 00:10:24,140
the velocity or the player's move speed

245
00:10:24,140 --> 00:10:25,940
or whatever you want to use.

246
00:10:25,940 --> 00:10:28,910
So why are we creating this return value?

247
00:10:28,910 --> 00:10:31,270
Because in the break bubbles,

248
00:10:31,265 --> 00:10:35,275
we want to make sure that the player is actually dashing.

249
00:10:35,270 --> 00:10:36,680
So we will add to

250
00:10:36,680 --> 00:10:39,220
the condition in the on collision enter.

251
00:10:39,215 --> 00:10:42,065
We want to make sure that it's not just the layer.

252
00:10:42,065 --> 00:10:44,065
We want to make sure that it's the player

253
00:10:44,060 --> 00:10:47,750
dashing that just hit our pot.

254
00:10:47,750 --> 00:10:49,910
So that information create

255
00:10:49,910 --> 00:10:52,870
the method that will return a Boolean value.

256
00:10:52,865 --> 00:10:54,575
Pause the video right now.

257
00:10:54,575 --> 00:10:56,555
Go do the challenge. Go do your best.

258
00:10:56,555 --> 00:10:58,675
I know we haven't done this type of

259
00:10:58,670 --> 00:11:01,240
method which returns something other than void.

260
00:11:01,235 --> 00:11:06,145
But I know you are up to just try to do your best.

261
00:11:06,140 --> 00:11:08,260
Okay, welcome back.

262
00:11:08,255 --> 00:11:10,445
I hope that wasn't too hard.

263
00:11:10,445 --> 00:11:14,275
I'm going to go into the layer controller.

264
00:11:14,270 --> 00:11:17,260
Okay, so what is the problem in here?

265
00:11:17,255 --> 00:11:19,915
You might say that, Well actually,

266
00:11:19,910 --> 00:11:22,730
I just want to access the current movement.

267
00:11:22,730 --> 00:11:24,350
And I can immediately know

268
00:11:24,350 --> 00:11:26,170
what the speed of the player is.

269
00:11:26,165 --> 00:11:27,865
But in here you can see that

270
00:11:27,860 --> 00:11:29,620
the current movement is private.

271
00:11:29,615 --> 00:11:32,425
So what we'll need to do as we are going to

272
00:11:32,420 --> 00:11:36,070
create a method in here.

273
00:11:36,065 --> 00:11:37,795
And that method is going to be

274
00:11:37,790 --> 00:11:45,340
a public bool layer is dashing.

275
00:11:45,335 --> 00:11:47,345
And what are we doing in here?

276
00:11:47,345 --> 00:11:49,145
We are going to check if

277
00:11:49,145 --> 00:11:54,625
the current movement speed is equal to the dash speed.

278
00:11:54,620 --> 00:11:56,800
We could have also used the candle,

279
00:11:56,795 --> 00:11:59,995
but they can dash isn't equivalent.

280
00:11:59,990 --> 00:12:00,620
Where is it?

281
00:12:00,620 --> 00:12:03,250
Where are we resetting the numerator.

282
00:12:03,245 --> 00:12:05,545
So he can dash is not

283
00:12:05,540 --> 00:12:09,340
equivalent to when the movement speed stops.

284
00:12:09,335 --> 00:12:13,735
So we can dash is just to cool down the dashing

285
00:12:13,730 --> 00:12:15,260
while the movement speed is

286
00:12:15,260 --> 00:12:18,610
immediately related to the dashed length.

287
00:12:18,605 --> 00:12:20,455
So back in here,

288
00:12:20,450 --> 00:12:23,900
if the current speed is equal to the dash speed,

289
00:12:23,900 --> 00:12:29,270
we are going to return true.

290
00:12:29,270 --> 00:12:36,360
Else we are going to return false.

291
00:12:39,220 --> 00:12:41,690
And by the way, we could have

292
00:12:41,690 --> 00:12:43,160
done something similar to this,

293
00:12:43,160 --> 00:12:46,560
so I can remove these.

294
00:12:47,410 --> 00:12:50,360
And as you can see, it's much cleaner.

295
00:12:50,360 --> 00:12:52,780
Why? Because we only have one line of

296
00:12:52,775 --> 00:12:55,925
code under the if and else statements.

297
00:12:55,925 --> 00:12:59,575
Otherwise we could not have used this way.

298
00:12:59,570 --> 00:13:01,220
Now we have it as public.

299
00:13:01,220 --> 00:13:02,870
We go back to the breakable.

300
00:13:02,870 --> 00:13:04,580
We are going to go ahead and

301
00:13:04,580 --> 00:13:07,100
create a Boolean inside of year 4.

302
00:13:07,100 --> 00:13:10,010
We destroy the pot after we check for the collision,

303
00:13:10,010 --> 00:13:11,420
obviously because we don't want to

304
00:13:11,420 --> 00:13:13,390
always know what the player speed

305
00:13:13,385 --> 00:13:17,045
unless it's the actual player collided with, just hit.

306
00:13:17,045 --> 00:13:20,875
So I'm going to go ahead and create a bool.

307
00:13:20,870 --> 00:13:25,970
And it's going to be layer is dashing.

308
00:13:25,970 --> 00:13:27,530
And it's going to be equal to

309
00:13:27,530 --> 00:13:31,430
the collision dot game object dot get component.

310
00:13:31,430 --> 00:13:34,970
So it's a bit different than when we are using a trigger.

311
00:13:34,970 --> 00:13:37,190
And in here we are going to simply

312
00:13:37,190 --> 00:13:39,770
get the player controller.

313
00:13:39,770 --> 00:13:42,320
And we are going to check if

314
00:13:42,320 --> 00:13:46,220
the layer is dashing, save that.

315
00:13:46,220 --> 00:13:50,180
So now this should either return true or false.

316
00:13:50,179 --> 00:13:56,019
And in here we're going to check if the layer is dashing.

317
00:13:56,015 --> 00:13:58,695
Then we are going to start the animation.

318
00:13:58,699 --> 00:14:00,499
And when the animation starts at

319
00:14:00,500 --> 00:14:03,530
breaks and destroy stick game object eventually.

320
00:14:03,530 --> 00:14:05,900
So one thing that I wanted to

321
00:14:05,900 --> 00:14:08,750
mention here is in here we used collider.

322
00:14:08,750 --> 00:14:10,570
In here we use the game object.

323
00:14:10,565 --> 00:14:13,615
We could have used the game object in here, save that,

324
00:14:13,610 --> 00:14:15,320
and it would have worked the same,

325
00:14:15,320 --> 00:14:18,280
but the collision, you can see right here,

326
00:14:18,275 --> 00:14:19,625
it returns a collision.

327
00:14:19,625 --> 00:14:21,815
It doesn't have the certain,

328
00:14:21,815 --> 00:14:23,965
Let's say methods that we need.

329
00:14:23,960 --> 00:14:25,960
So if I go for example,

330
00:14:25,955 --> 00:14:27,445
and on the other place,

331
00:14:27,440 --> 00:14:29,570
so level exit for example, in here,

332
00:14:29,570 --> 00:14:33,430
the collider 2D is different than the collision 2D.

333
00:14:33,425 --> 00:14:35,335
So collision is part of

334
00:14:35,330 --> 00:14:38,110
the detailed return to the physics.

335
00:14:38,105 --> 00:14:40,115
If we look in the level exit,

336
00:14:40,115 --> 00:14:44,035
the collider 2D actually returns the game objects

337
00:14:44,030 --> 00:14:45,650
so we can immediately access

338
00:14:45,650 --> 00:14:48,020
the tag while when it comes to the collision,

339
00:14:48,020 --> 00:14:49,780
It's just a little bit different.

340
00:14:49,775 --> 00:14:52,805
I recommend that you go through Unity's documentation,

341
00:14:52,805 --> 00:14:55,705
see what the difference between collision collider.

342
00:14:55,700 --> 00:14:57,110
These are small things,

343
00:14:57,110 --> 00:14:59,570
but just know that we are accessing

344
00:14:59,570 --> 00:15:03,370
the game object first and then using the compare tack.

345
00:15:03,365 --> 00:15:04,985
With that out of the way,

346
00:15:04,985 --> 00:15:06,205
let's save all of this.

347
00:15:06,200 --> 00:15:07,720
Let's go back into our game.

348
00:15:07,715 --> 00:15:09,065
Let's run the game.

349
00:15:09,065 --> 00:15:12,295
Let's try to break the patois walking.

350
00:15:12,290 --> 00:15:14,960
Okay, there you go. So it's not breaking.

351
00:15:14,960 --> 00:15:16,510
And if I tried to dash,

352
00:15:16,505 --> 00:15:18,505
oops, I forgot the bottom two dash.

353
00:15:18,500 --> 00:15:21,110
If I dash. Okay.

354
00:15:21,110 --> 00:15:22,850
It's also not working.

355
00:15:22,850 --> 00:15:23,890
Why is that?

356
00:15:23,885 --> 00:15:25,945
Okay, so it broke. There you go.

357
00:15:25,940 --> 00:15:29,030
Let's try this one more time because

358
00:15:29,030 --> 00:15:32,200
there is something that was a bit slow.

359
00:15:32,195 --> 00:15:37,675
And I believe the problem is with the game.

360
00:15:37,670 --> 00:15:39,410
Wait for a second.

361
00:15:39,410 --> 00:15:41,950
So I think I want to move this,

362
00:15:41,945 --> 00:15:46,255
the thing that handles the collider.

363
00:15:46,250 --> 00:15:47,590
I want to move it to the beginning.

364
00:15:47,585 --> 00:15:49,795
Save that because I want the collider to

365
00:15:49,790 --> 00:15:52,570
disappear as soon as we start breaking the buck.

366
00:15:52,565 --> 00:15:54,575
So there we go.

367
00:15:54,575 --> 00:15:58,225
You can see right now that we can simply move through.

368
00:15:58,220 --> 00:16:00,680
Now if you want to add a bit more,

369
00:16:00,680 --> 00:16:02,960
maybe I don't know authenticity

370
00:16:02,960 --> 00:16:04,700
that we want to keep it just a

371
00:16:04,700 --> 00:16:06,800
teeny tiny second before we

372
00:16:06,800 --> 00:16:09,190
go ahead and break it, It's your choice.

373
00:16:09,185 --> 00:16:12,355
Make sure that you choose whatever you want.

374
00:16:12,350 --> 00:16:13,310
Let me see.

375
00:16:13,310 --> 00:16:14,860
Okay, so if I want to move,

376
00:16:14,855 --> 00:16:17,275
if you move just the breakable pot,

377
00:16:17,270 --> 00:16:18,670
choose the second line.

378
00:16:18,665 --> 00:16:20,795
There you go and you can see that you can move it.

379
00:16:20,795 --> 00:16:22,285
So save that.

380
00:16:22,280 --> 00:16:24,290
Now we have everything working.

381
00:16:24,290 --> 00:16:26,500
Let's try to walk through it.

382
00:16:26,495 --> 00:16:28,735
It won't work. We walked through.

383
00:16:28,730 --> 00:16:32,170
It doesn't work with dash through it, it breaks.

384
00:16:32,165 --> 00:16:32,975
Great.

385
00:16:32,975 --> 00:16:36,295
Let's go and make sure that we stage everything.

386
00:16:36,290 --> 00:16:37,820
And in the next video,

387
00:16:37,820 --> 00:16:41,900
we want to show the broken pieces of our pot.

388
00:16:41,900 --> 00:16:44,780
So we want to have some kind of pieces that spread.

389
00:16:44,780 --> 00:16:47,680
That's why I created and the sprites in

390
00:16:47,675 --> 00:16:50,975
receivables here we have the P1, P2, and P3.

391
00:16:50,975 --> 00:16:52,555
These are pieces that are

392
00:16:52,550 --> 00:16:54,470
going to lay around this and they

393
00:16:54,470 --> 00:16:58,340
will add a bit more of a feeling of pots breaking.

394
00:16:58,340 --> 00:17:00,410
So we want to have pieces flying around

395
00:17:00,410 --> 00:17:03,170
a bit and then disappear slowly,

396
00:17:03,170 --> 00:17:05,500
making things a bit more authentic,

397
00:17:05,495 --> 00:17:07,355
a bit less rigid.

398
00:17:07,355 --> 00:17:09,845
So I'll see you then.

