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

2
00:00:03,150 --> 00:00:05,360
in this video and this long video,

3
00:00:05,355 --> 00:00:08,715
again, we are going to be learning how to create a chest.

4
00:00:08,715 --> 00:00:10,235
But this is a really cool

5
00:00:10,230 --> 00:00:11,940
just because when we get near it,

6
00:00:11,940 --> 00:00:14,970
it tells us that we can press the e to open chest.

7
00:00:14,970 --> 00:00:18,300
If we press the E, you'll see that we get an open chest.

8
00:00:18,300 --> 00:00:20,610
There we go. So this is all that we've done.

9
00:00:20,610 --> 00:00:24,720
So let's not waste any more time and let's get started.

10
00:00:24,720 --> 00:00:27,030
Oh, okay, welcome back.

11
00:00:27,030 --> 00:00:30,510
So now we know how we can pick up weapons.

12
00:00:30,510 --> 00:00:32,670
We can add them easily to the player,

13
00:00:32,670 --> 00:00:33,780
we can shoot with them.

14
00:00:33,780 --> 00:00:37,230
We update the UI, everything is working perfectly,

15
00:00:37,230 --> 00:00:38,510
but as we've said,

16
00:00:38,510 --> 00:00:40,910
we want to add a bit more flavor

17
00:00:40,909 --> 00:00:43,489
to the way we actually get these guns.

18
00:00:43,490 --> 00:00:46,160
And the way we'll do that is having a chests

19
00:00:46,159 --> 00:00:49,149
and our levels that we can click on.

20
00:00:49,145 --> 00:00:51,115
They open up, they give us the weapon,

21
00:00:51,110 --> 00:00:53,750
we pick it up, we continue on with our game.

22
00:00:53,750 --> 00:00:55,760
So let's go ahead and do that.

23
00:00:55,760 --> 00:00:59,560
I'm going to delete the three weapons pickup.

24
00:00:59,555 --> 00:01:01,465
I'm going to go into the sprites and

25
00:01:01,460 --> 00:01:03,460
before obviously before you delete them,

26
00:01:03,455 --> 00:01:05,615
we need to have them as prefabs.

27
00:01:05,615 --> 00:01:07,885
Then we'll go into the sprites.

28
00:01:07,880 --> 00:01:09,770
We are going to right-click in here,

29
00:01:09,770 --> 00:01:13,210
create a folder for the chest.

30
00:01:13,205 --> 00:01:15,955
Double-click in here and go into

31
00:01:15,950 --> 00:01:20,030
the visit into the resources, drag the chests.

32
00:01:20,030 --> 00:01:22,250
Obviously, if you can find by their chests,

33
00:01:22,250 --> 00:01:24,340
I recommend that you go for it.

34
00:01:24,335 --> 00:01:26,135
I'm going to make it multiple.

35
00:01:26,135 --> 00:01:29,035
I'm going to make it by point.

36
00:01:29,030 --> 00:01:32,510
The filter mode go to this pride, apply obviously.

37
00:01:32,509 --> 00:01:34,869
And now let's go ahead and slice this up.

38
00:01:34,865 --> 00:01:38,015
I believe the automatic should work perfectly fine.

39
00:01:38,015 --> 00:01:40,355
There we go, apply the changes.

40
00:01:40,355 --> 00:01:42,455
Which box do you want to choose?

41
00:01:42,455 --> 00:01:44,605
I'll choose the golden one.

42
00:01:44,600 --> 00:01:48,770
So the, this one and this one when it opens up.

43
00:01:48,770 --> 00:01:52,160
So we will need to have two kinds of sprites in here,

44
00:01:52,160 --> 00:01:55,210
140, open chest 14, the closed one.

45
00:01:55,205 --> 00:01:58,075
I'm going to drag and add it into the world right

46
00:01:58,070 --> 00:02:01,220
here and set it on the player layer.

47
00:02:01,220 --> 00:02:03,560
Obviously it's extremely small.

48
00:02:03,560 --> 00:02:06,380
So I'm going to change this from the treasure chest

49
00:02:06,380 --> 00:02:10,310
to the weapons chest,

50
00:02:10,310 --> 00:02:12,200
and let's make it a bit bigger.

51
00:02:12,200 --> 00:02:17,320
So I believe 16 maybe 16 is too big.

52
00:02:17,315 --> 00:02:19,225
Is too big of a chest.

53
00:02:19,220 --> 00:02:21,430
Nope, I think that is good enough.

54
00:02:21,425 --> 00:02:24,535
Now we're going to go to the scripts right-click or no,

55
00:02:24,530 --> 00:02:27,770
do we have something pickups, level flow?

56
00:02:27,770 --> 00:02:31,010
Do we have a folder suitable for the Nope,

57
00:02:31,010 --> 00:02:32,170
we don't have one.

58
00:02:32,165 --> 00:02:34,045
So I'm going to right-click create

59
00:02:34,040 --> 00:02:38,020
a folder for the weapons.

60
00:02:38,015 --> 00:02:44,345
Just copy that inside of here. Where did we go?

61
00:02:44,345 --> 00:02:46,805
Weapons.

62
00:02:46,805 --> 00:02:49,735
But we have sorry for that.

63
00:02:49,730 --> 00:02:52,310
The weapon just okay. For some reason.

64
00:02:52,310 --> 00:02:55,580
Just opened up some different folder

65
00:02:55,580 --> 00:02:57,280
anyways, we create this.

66
00:02:57,275 --> 00:03:00,125
It's the weapons, chest.

67
00:03:00,125 --> 00:03:03,355
Hit Enter, wait for it to compile.

68
00:03:03,350 --> 00:03:09,380
And any day now we add it to the actual weapons,

69
00:03:09,380 --> 00:03:11,570
just and open up the script.

70
00:03:11,570 --> 00:03:14,140
Okay, so what do we need to have in here?

71
00:03:14,135 --> 00:03:16,045
First of all, we want this just

72
00:03:16,040 --> 00:03:18,170
to give us random weapons.

73
00:03:18,170 --> 00:03:20,000
So what we'll do, and this is

74
00:03:20,000 --> 00:03:21,860
just a mechanic that I want to have.

75
00:03:21,860 --> 00:03:23,990
Maybe you'd want to create something different,

76
00:03:23,990 --> 00:03:28,550
but for now serialized field, the weapons pickup.

77
00:03:28,550 --> 00:03:30,770
And it's going to be a,

78
00:03:30,769 --> 00:03:35,879
an array with the potential weapons.

79
00:03:36,250 --> 00:03:39,080
So the potential weapons,

80
00:03:39,080 --> 00:03:44,890
then I'm going to create a private sprite renderer.

81
00:03:44,885 --> 00:03:47,285
What does it, right?

82
00:03:47,285 --> 00:03:48,235
Renderer.

83
00:03:48,230 --> 00:03:51,830
And it's going to be the chest as R.

84
00:03:51,830 --> 00:03:53,810
And you'll understand everything.

85
00:03:53,810 --> 00:03:57,200
But for now, let's continue on.

86
00:03:57,200 --> 00:04:00,880
The obviously the just sprite render this will be,

87
00:04:00,875 --> 00:04:02,365
we need a reference to width.

88
00:04:02,360 --> 00:04:03,950
You'll understand in just a bit.

89
00:04:03,950 --> 00:04:06,890
Now I'm going to create another serialized field,

90
00:04:06,890 --> 00:04:08,720
just going to be a sprite.

91
00:04:08,720 --> 00:04:14,380
And that sprite is going to be the open just sprite.

92
00:04:14,375 --> 00:04:18,535
And then we are going to have some kind of text.

93
00:04:18,530 --> 00:04:23,730
And because we need to be using Unity engine Wi,

94
00:04:23,740 --> 00:04:26,890
now we can access the text

95
00:04:26,885 --> 00:04:29,915
and it's going to be the open key text.

96
00:04:29,915 --> 00:04:33,875
Open key texts.

97
00:04:33,875 --> 00:04:35,305
And I don't mean by key,

98
00:04:35,300 --> 00:04:37,610
the key that will allow us to open the chest.

99
00:04:37,610 --> 00:04:40,360
Well, I sort of do, but the key,

100
00:04:40,355 --> 00:04:41,995
which key do we press on

101
00:04:41,990 --> 00:04:44,660
the keyboard in order to open the chest?

102
00:04:44,660 --> 00:04:46,240
Now that I think about,

103
00:04:46,235 --> 00:04:50,015
maybe that's why they named the Key Vault maybe.

104
00:04:50,015 --> 00:04:51,925
And with private, finally,

105
00:04:51,920 --> 00:04:56,620
we need a Boolean to make sure that we can open.

106
00:04:56,615 --> 00:04:58,345
That means that we are going to be in

107
00:04:58,340 --> 00:05:00,760
the vicinity of this.

108
00:05:00,755 --> 00:05:01,895
And chest.

109
00:05:01,895 --> 00:05:05,725
And why do we first of all, she asked,

110
00:05:05,720 --> 00:05:08,540
why do we need the chest sprite renderer and

111
00:05:08,540 --> 00:05:11,090
why do we need the open chest sprite?

112
00:05:11,090 --> 00:05:14,390
Well, because when we open chest, there you go.

113
00:05:14,390 --> 00:05:18,310
When we see the sprite, just a second.

114
00:05:18,305 --> 00:05:19,915
When we see we have two sprites,

115
00:05:19,910 --> 00:05:21,050
one for the close 1,

116
00:05:21,050 --> 00:05:22,460
1 for the open one.

117
00:05:22,460 --> 00:05:25,430
That's why we need a reference to the sprite renderer to

118
00:05:25,430 --> 00:05:28,870
change this bright when we actually open the chest.

119
00:05:28,865 --> 00:05:32,425
So I'm going to go ahead and add

120
00:05:32,420 --> 00:05:36,110
the open chest sprite, the potential weapons.

121
00:05:36,110 --> 00:05:38,510
I'm going to add that and just lock this down

122
00:05:38,510 --> 00:05:41,830
for a second to the Prefabs.

123
00:05:41,825 --> 00:05:45,275
Pickups, V3 weapons.

124
00:05:45,275 --> 00:05:47,585
Or even if you want you can add the helpful.

125
00:05:47,585 --> 00:05:49,765
So, so maybe you get the help from

126
00:05:49,760 --> 00:05:52,190
the chest and short, let's do that.

127
00:05:52,190 --> 00:05:55,870
Let's add also the health just for fun.

128
00:05:55,865 --> 00:05:56,485
Oh, okay.

129
00:05:56,480 --> 00:05:58,780
So it's a, it's an array

130
00:05:58,775 --> 00:06:02,215
of what does it the weapon system.

131
00:06:02,210 --> 00:06:03,710
So or sorry, weapons

132
00:06:03,710 --> 00:06:05,650
pickups or we can't add the health mice.

133
00:06:05,645 --> 00:06:08,095
That something that I did not realize.

134
00:06:08,090 --> 00:06:11,000
But anyways, let's continue on and start.

135
00:06:11,000 --> 00:06:13,610
We need to get a reference to the sprite renderer.

136
00:06:13,610 --> 00:06:16,760
So the chest as r is equal to

137
00:06:16,760 --> 00:06:22,900
the debt component sprite renderer. There we go.

138
00:06:22,895 --> 00:06:25,075
So now we have a reference to it.

139
00:06:25,070 --> 00:06:26,930
And when we actually open the chest,

140
00:06:26,930 --> 00:06:29,810
we want to change the sprite to something different.

141
00:06:29,810 --> 00:06:32,020
Now before I continue one,

142
00:06:32,015 --> 00:06:34,825
I remember the little hint

143
00:06:34,820 --> 00:06:36,410
that I gave in the previous video.

144
00:06:36,410 --> 00:06:38,810
We don't want every single time create

145
00:06:38,810 --> 00:06:41,690
the if the tag is the player.

146
00:06:41,690 --> 00:06:45,250
So let's go ahead and create a new layer.

147
00:06:45,245 --> 00:06:46,995
Layers.

148
00:06:46,999 --> 00:06:48,799
Oh, okay, so we need to remove this.

149
00:06:48,800 --> 00:06:51,670
And we're going to create the pickups.

150
00:06:51,665 --> 00:06:53,075
Hit Enter.

151
00:06:53,075 --> 00:06:57,145
And now where we can go and set all of these pickups

152
00:06:57,140 --> 00:07:01,340
to be working or all have the layer pickups.

153
00:07:01,339 --> 00:07:04,799
Save that and now go to the Edit,

154
00:07:05,040 --> 00:07:08,710
sorry, Edit Project Settings.

155
00:07:08,710 --> 00:07:09,690
Where is it?

156
00:07:09,685 --> 00:07:12,295
Physics, 2D, and the pickups,

157
00:07:12,295 --> 00:07:14,655
all the interact with the player.

158
00:07:14,650 --> 00:07:17,640
So I'm going to turn everything off except the PLR.

159
00:07:17,635 --> 00:07:19,755
We save that, we go back.

160
00:07:19,750 --> 00:07:23,200
Now we will make sure that this even the chest,

161
00:07:23,200 --> 00:07:25,510
we can make sure actually

162
00:07:25,510 --> 00:07:28,170
we should make it as the pickup also.

163
00:07:28,165 --> 00:07:31,275
So it only interacts with a player and we don't need to

164
00:07:31,270 --> 00:07:34,480
check for the tag every single time.

165
00:07:34,480 --> 00:07:36,430
So what does this out also?

166
00:07:36,430 --> 00:07:39,250
So now, what else do we need to do?

167
00:07:39,250 --> 00:07:43,030
Well, we need to create a canvas for this chest

168
00:07:43,030 --> 00:07:44,920
that will have some kind of word

169
00:07:44,920 --> 00:07:47,280
right here or texts that will display.

170
00:07:47,280 --> 00:07:49,640
For example, press E to

171
00:07:49,640 --> 00:07:52,360
open the chest or press C or whatever.

172
00:07:52,355 --> 00:07:54,805
So I'm going to right-click on the weapons,

173
00:07:54,800 --> 00:08:00,100
just go down to u i and create a canvas.

174
00:08:00,095 --> 00:08:02,215
Really nice. So now you can see that we

175
00:08:02,210 --> 00:08:04,670
have a, another huge canvas.

176
00:08:04,670 --> 00:08:06,310
What are we going to do about?

177
00:08:06,305 --> 00:08:09,295
Obviously, we don't want it to be that big.

178
00:08:09,290 --> 00:08:10,540
So what we can do,

179
00:08:10,535 --> 00:08:13,585
we can set it as the world space right here.

180
00:08:13,580 --> 00:08:18,010
And this will allow us to change the scale right here.

181
00:08:18,005 --> 00:08:22,855
So I'm going to set the scale to 0.01 on the x,

182
00:08:22,850 --> 00:08:25,420
0.01 on the y.

183
00:08:25,415 --> 00:08:30,625
And let's just keep it at 0 or the Z at 1212 factors.

184
00:08:30,620 --> 00:08:33,350
I'm going to change the position to 0.

185
00:08:33,350 --> 00:08:35,810
And you can see how small the canvas is right now,

186
00:08:35,810 --> 00:08:37,990
this little square right here.

187
00:08:37,985 --> 00:08:41,255
And I'm going to change the x and the y to 0.

188
00:08:41,255 --> 00:08:44,575
Now I double-click on the weapons just and there you go.

189
00:08:44,570 --> 00:08:47,840
You can see that we have the canvas right here.

190
00:08:47,840 --> 00:08:51,970
So now I'm going to add another 0 and here,

191
00:08:51,965 --> 00:08:54,845
and maybe another one also on the Y.

192
00:08:54,845 --> 00:08:56,515
Okay, that's too small.

193
00:08:56,510 --> 00:08:59,060
And let's maybe try to okay.

194
00:08:59,060 --> 00:09:00,110
That's too much.

195
00:09:00,110 --> 00:09:06,850
Sorry. And maybe we just make it around 35,

196
00:09:06,845 --> 00:09:10,805
okay, five on the y and on the x.

197
00:09:10,805 --> 00:09:13,225
Excellent, so now we have it That's

198
00:09:13,220 --> 00:09:16,220
reset its position back on to these 000,

199
00:09:16,220 --> 00:09:18,350
maybe increase the height template.

200
00:09:18,350 --> 00:09:23,150
And we'll call this the chest Canvas.

201
00:09:23,150 --> 00:09:24,530
And as you can see now it's

202
00:09:24,530 --> 00:09:27,200
a very small canvas and we need to make sure that it's

203
00:09:27,200 --> 00:09:31,720
world space and now opens up.

204
00:09:31,715 --> 00:09:33,245
And on the chest Canvas,

205
00:09:33,245 --> 00:09:37,045
I'm going to go ahead and create a text Mesh pro.

206
00:09:37,040 --> 00:09:42,070
And this text much Pro is going to say open, press key,

207
00:09:42,065 --> 00:09:50,795
press E to open chest and enter this down a bit.

208
00:09:50,795 --> 00:09:55,385
Make it bold, make the robot font that we have,

209
00:09:55,385 --> 00:09:57,475
and make it auto size.

210
00:09:57,470 --> 00:09:59,920
And let's see how that looks.

211
00:09:59,915 --> 00:10:04,905
I'm going to zoom back in and make this a bit bigger.

212
00:10:04,909 --> 00:10:09,569
Where is the text color?

213
00:10:09,790 --> 00:10:12,300
Whereas the text anyways,

214
00:10:12,304 --> 00:10:13,764
I cannot see it.

215
00:10:13,760 --> 00:10:14,660
Oh, case.

216
00:10:14,660 --> 00:10:16,760
So what we need to do is we also

217
00:10:16,760 --> 00:10:19,070
need to change this to this sorting layer.

218
00:10:19,070 --> 00:10:21,470
And there we go, we can see that the text is,

219
00:10:21,470 --> 00:10:24,230
and here, and I was testing this out on the 2D.

220
00:10:24,230 --> 00:10:25,880
I was wondering what was wrong.

221
00:10:25,880 --> 00:10:29,000
And I thought that maybe if we are in 3D,

222
00:10:29,000 --> 00:10:30,440
I could change the Z position.

223
00:10:30,440 --> 00:10:34,340
But no, it turns out that on the actual just Canvas.

224
00:10:34,340 --> 00:10:35,720
Have it in world space.

225
00:10:35,720 --> 00:10:38,000
You can choose the sorting layer and

226
00:10:38,000 --> 00:10:40,990
we'll make it on the player layer.

227
00:10:40,985 --> 00:10:45,185
And I'm going to make sure that this is bold, auto sized.

228
00:10:45,185 --> 00:10:48,265
And we are going to move the text up a bit,

229
00:10:48,260 --> 00:10:50,480
so this is where it will appear.

230
00:10:50,480 --> 00:10:53,750
And I'm going to increase the size and

231
00:10:53,750 --> 00:10:57,250
we'll make sure that the max is bigger.

232
00:10:57,245 --> 00:11:00,025
Okay, So increase the max as much as

233
00:11:00,020 --> 00:11:04,250
possible and we can resize it to your heart's content.

234
00:11:04,250 --> 00:11:05,870
How much you want to,

235
00:11:05,870 --> 00:11:07,100
how big do you want to make it?

236
00:11:07,100 --> 00:11:08,450
How small do you want to make it?

237
00:11:08,450 --> 00:11:11,020
It comes back to you.

238
00:11:11,015 --> 00:11:13,805
So I'm going to set it up here, save that.

239
00:11:13,805 --> 00:11:16,345
Now the next thing is we'll go into the weapons,

240
00:11:16,340 --> 00:11:19,000
just let's add a couple of colliders.

241
00:11:18,995 --> 00:11:21,805
The first one will be a collider that will

242
00:11:21,800 --> 00:11:25,250
just make sure that we keep things intact.

243
00:11:25,250 --> 00:11:27,650
And then make sure that we don't just walk through

244
00:11:27,650 --> 00:11:30,680
the chest and then we'll make a second box collider.

245
00:11:30,680 --> 00:11:32,950
And this one will be a trigger.

246
00:11:32,945 --> 00:11:39,875
And I'm going to change its size to be about yea big,

247
00:11:39,875 --> 00:11:43,225
so able bigger than the actual box.

248
00:11:43,220 --> 00:11:45,410
Or if we stand in this position,

249
00:11:45,410 --> 00:11:47,900
we will be able to open up the box.

250
00:11:47,900 --> 00:11:49,760
So save all of that,

251
00:11:49,760 --> 00:11:52,160
make sure that it is a trigger.

252
00:11:52,160 --> 00:11:56,230
Now what we're going to do is issue you a challenge.

253
00:11:56,225 --> 00:11:59,075
And your challenge is to know what's in the box.

254
00:11:59,075 --> 00:12:00,715
If you know this picture, you know it.

255
00:12:00,710 --> 00:12:02,210
If you don't know the reference,

256
00:12:02,210 --> 00:12:03,670
then it's your problem.

257
00:12:03,665 --> 00:12:06,895
Then anyways, opened the box under certain conditions.

258
00:12:06,890 --> 00:12:08,420
So we want to open the box.

259
00:12:08,420 --> 00:12:11,140
We want to be pressing the Iike.

260
00:12:11,135 --> 00:12:13,495
We need to make sure that we want to be

261
00:12:13,490 --> 00:12:16,510
standing next to the box when we are opening it.

262
00:12:16,505 --> 00:12:19,315
So when we are not standing inside of the box,

263
00:12:19,310 --> 00:12:21,820
we don't want to have the ability to open it.

264
00:12:21,815 --> 00:12:23,815
And also make sure we display

265
00:12:23,810 --> 00:12:26,980
the text when we are next to the box.

266
00:12:26,975 --> 00:12:29,575
So need to have two ways.

267
00:12:29,570 --> 00:12:32,920
Whether we are near the box or we're not near the box,

268
00:12:32,915 --> 00:12:35,705
we will be displaying the text and we can

269
00:12:35,705 --> 00:12:38,785
open it if we are next to it or not.

270
00:12:38,780 --> 00:12:40,460
So the pattern formation

271
00:12:40,460 --> 00:12:42,580
with these conditions in your mind,

272
00:12:42,575 --> 00:12:47,575
pause the video right now and go do the following.

273
00:12:47,570 --> 00:12:49,610
Okay, welcome back.

274
00:12:49,610 --> 00:12:53,230
So I'm going to just get started because we are have

275
00:12:53,225 --> 00:12:57,805
already wasted a lot of time on simple details and ways.

276
00:12:57,800 --> 00:12:59,270
We are on the Trigger Enter.

277
00:12:59,270 --> 00:13:02,230
We won't be checking for the player tag for now.

278
00:13:02,225 --> 00:13:06,805
And we are going to make sure that the open key text dot

279
00:13:06,800 --> 00:13:11,730
GameObject dots are active is true.

280
00:13:11,725 --> 00:13:15,075
So we'll be turning it off and only when we are inside of

281
00:13:15,070 --> 00:13:17,370
the collider we are going to

282
00:13:17,365 --> 00:13:20,125
open it up and on the arm trigger exit 3,

283
00:13:20,125 --> 00:13:21,405
we are going to have

284
00:13:21,400 --> 00:13:25,680
the same thing and we'll just put it in here.

285
00:13:25,675 --> 00:13:27,895
Instead of true, it's going to be false.

286
00:13:27,895 --> 00:13:28,825
Excellent.

287
00:13:28,825 --> 00:13:30,705
Now, what is the next thing that

288
00:13:30,700 --> 00:13:32,590
we want to do is we want to make sure

289
00:13:32,590 --> 00:13:36,940
that we can open and it's set to true.

290
00:13:36,940 --> 00:13:39,270
And if we're not,

291
00:13:39,265 --> 00:13:41,635
then set can open.

292
00:13:41,635 --> 00:13:44,295
Well, I just make this a parentheses.

293
00:13:44,290 --> 00:13:47,640
Nope, can open z equal to true

294
00:13:47,635 --> 00:13:52,245
and can open is equal to false.

295
00:13:52,245 --> 00:13:54,185
There we go, we save that.

296
00:13:54,185 --> 00:13:55,945
And let's just have an update in here.

297
00:13:55,940 --> 00:14:00,400
We removed it and we're just going to be debugging.

298
00:14:00,395 --> 00:14:11,095
Dot log can open equal to can open.

299
00:14:11,090 --> 00:14:13,270
There we go. We save that.

300
00:14:13,265 --> 00:14:16,585
What's the problem Boolean into an object.

301
00:14:16,580 --> 00:14:18,140
For some reason, I just

302
00:14:18,140 --> 00:14:20,210
forgot all the context and the world.

303
00:14:20,210 --> 00:14:21,800
Okay, with that done,

304
00:14:21,800 --> 00:14:24,020
let's go back and check in.

305
00:14:24,020 --> 00:14:27,110
Here. We run the game. We have in our console.

306
00:14:27,110 --> 00:14:28,580
It's false, false, false, false.

307
00:14:28,580 --> 00:14:30,560
When we walk into the box,

308
00:14:30,560 --> 00:14:32,230
there we go, we'd get an error.

309
00:14:32,225 --> 00:14:33,325
Excellent. Why is that?

310
00:14:33,320 --> 00:14:37,910
Because obviously we forgot to set the result goes down,

311
00:14:37,910 --> 00:14:39,580
goes down the text.

312
00:14:39,575 --> 00:14:41,485
How great is that?

313
00:14:41,480 --> 00:14:44,960
O, and we also forgot to,

314
00:14:44,960 --> 00:14:49,040
I hope some of you picked up on this DTM probe.

315
00:14:49,040 --> 00:14:51,050
And this is not just any text,

316
00:14:51,050 --> 00:14:55,840
it's a text Mesh parole Gui.

317
00:14:55,835 --> 00:14:59,255
So save that, go back in here and

318
00:14:59,255 --> 00:15:02,645
now we should see that we add the text,

319
00:15:02,645 --> 00:15:04,385
save that, run the game.

320
00:15:04,385 --> 00:15:06,865
Oh, and one more thing, excuse me.

321
00:15:06,860 --> 00:15:09,620
We need to make sure that we turn of the text.

322
00:15:09,620 --> 00:15:12,340
Just save that.

323
00:15:12,335 --> 00:15:15,325
Again. Let's make this a bit bigger.

324
00:15:15,320 --> 00:15:17,420
So we false, False, False can open.

325
00:15:17,420 --> 00:15:19,780
Then we run in here, can open true.

326
00:15:19,775 --> 00:15:21,865
We have the press Chest E.

327
00:15:21,860 --> 00:15:24,260
And finally the last step we actually

328
00:15:24,260 --> 00:15:27,010
want to an update in here.

329
00:15:27,005 --> 00:15:29,255
Let's remove this. We know what works.

330
00:15:29,255 --> 00:15:33,365
We are going to make sure that if the input

331
00:15:33,365 --> 00:15:38,465
dot get key down,

332
00:15:38,465 --> 00:15:41,145
we open this up key code,

333
00:15:41,149 --> 00:15:47,059
the e. So when we press E and we can open,

334
00:15:47,060 --> 00:15:52,160
then we are going to get the chest as our sprite.

335
00:15:52,160 --> 00:15:54,720
And it's going to be equal to the open.

336
00:15:54,724 --> 00:15:56,844
Just sprite.

337
00:15:56,840 --> 00:16:00,180
Save that back in our game.

338
00:16:00,520 --> 00:16:03,170
Now we run the game.

339
00:16:03,170 --> 00:16:06,100
We stand next to the chest.

340
00:16:06,095 --> 00:16:08,455
If we press the E key right here, nope,

341
00:16:08,450 --> 00:16:11,080
We cannot do anything if we just Iike right here.

342
00:16:11,075 --> 00:16:13,805
There we go. We can open the chest.

343
00:16:13,805 --> 00:16:15,025
How cool is that?

344
00:16:15,020 --> 00:16:16,040
So I hope you enjoyed

345
00:16:16,040 --> 00:16:18,680
this little tutorial on how to create chests.

346
00:16:18,680 --> 00:16:21,040
In the next video will be actually popping

347
00:16:21,035 --> 00:16:23,605
up some weapons whenever we open the chest.

348
00:16:23,600 --> 00:16:27,050
So I'll see you then makes sure to commit your changes.

349
00:16:27,050 --> 00:16:29,130
And I'll see you there.

