Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:06,656 --> 00:00:12,800
So what makes a game a game is well preventing the player
2
00:00:13,056 --> 00:00:19,200
I'm doing something and then having them actually able to accomplish something
3
00:00:19,456 --> 00:00:24,832
Because they completed that challenge I mean that's pretty obvious right so let's Create something called
4
00:00:25,088 --> 00:00:25,856
Date
5
00:00:26,368 --> 00:00:29,440
He wasn't actually going to move this down and
6
00:00:30,208 --> 00:00:32,256
Recreate some or Land Rover here
7
00:00:33,280 --> 00:00:36,864
How much is grab one of these grounds and paste it
8
00:00:38,144 --> 00:00:39,424
2
9
00:00:40,192 --> 00:00:44,032
That right here and drink a little bit this going to be a gate
10
00:00:45,056 --> 00:00:46,848
And then we'll take this
11
00:00:47,616 --> 00:00:49,408
Delicious cafe in
12
00:00:49,664 --> 00:00:55,808
Again can bring it up here so there's a gate to enter a new Zone and let's just put
13
00:00:56,064 --> 00:00:56,576
Here as well
14
00:00:58,880 --> 00:01:00,909
Beautiful writing
15
00:01:00,911 --> 00:01:03,387
Subtitled by
-♪ online-courses.club ♪-
We compress knowledge for you!
https://t.me/joinchat/ailxpXoW3JVjYzQ1
16
00:01:03,388 --> 00:01:05,280
This gate can only be
17
00:01:05,536 --> 00:01:08,096
Cast if you have a key
18
00:01:08,352 --> 00:01:08,864
Ok
19
00:01:09,376 --> 00:01:12,448
So we're going to do as we're going to first and foremost
20
00:01:12,704 --> 00:01:14,240
Let's make this gate
21
00:01:15,264 --> 00:01:17,312
I'm out just wait for now
22
00:01:17,568 --> 00:01:18,592
And that sort of
23
00:01:18,848 --> 00:01:19,616
Links
24
00:01:20,128 --> 00:01:22,688
The store to the key here
25
00:01:22,944 --> 00:01:23,712
Ok
26
00:01:24,480 --> 00:01:28,576
So we need to be able to check to see if the player has an inventory item
27
00:01:29,088 --> 00:01:30,368
If they do
28
00:01:30,624 --> 00:01:33,184
Then the gate what automatically open right
29
00:01:34,208 --> 00:01:37,792
So let's make sure that this ground that we copied and changed a little bit
30
00:01:38,048 --> 00:01:39,328
What causes gait
31
00:01:40,096 --> 00:01:42,144
And it's put it in our prefabs
32
00:01:43,424 --> 00:01:44,960
It'll be an original prefab
33
00:01:45,728 --> 00:01:49,824
Perfect by the way guys if you're getting errors while you're working on this
34
00:01:50,336 --> 00:01:55,200
Will eventually need a cleaning job but they're actually not causing any problems so
35
00:01:55,456 --> 00:01:57,248
Clear this out for now
36
00:01:58,272 --> 00:01:59,808
Skate here
37
00:02:00,320 --> 00:02:01,856
Create a new script
38
00:02:02,368 --> 00:02:05,696
That will do something if the player has
39
00:02:06,464 --> 00:02:09,280
Inhibitory item so it creates a new c-sharp script
40
00:02:09,792 --> 00:02:10,560
Weird colours
41
00:02:10,816 --> 00:02:11,328
Gate
42
00:02:14,144 --> 00:02:18,496
Again if you get weird there's like this it's just part of the course with unity
43
00:02:19,264 --> 00:02:22,592
I'm not cleaning up eventually but I don't worry about him right now
44
00:02:23,104 --> 00:02:24,896
A m dragon will be here
45
00:02:25,664 --> 00:02:27,200
And working at
46
00:02:27,968 --> 00:02:29,248
Agate script
47
00:02:29,760 --> 00:02:32,576
A select in the gate to dragon Andover
48
00:02:32,832 --> 00:02:36,160
Now currently do anything because we open up the Script
49
00:02:37,184 --> 00:02:41,024
It's nothing so what we're going to do
50
00:02:41,280 --> 00:02:45,888
Is there actually going to create a new on trigger enter
51
00:02:46,400 --> 00:02:47,168
Auction
52
00:02:47,936 --> 00:02:50,496
Remember that one that we had for a collectible here
53
00:02:51,008 --> 00:02:52,288
On trigger enter 2D
54
00:02:53,312 --> 00:02:56,384
What is going to use this same sort a function for the gate
55
00:02:57,408 --> 00:02:59,712
So ontriggerenter2d
56
00:03:01,248 --> 00:03:02,528
Do something
57
00:03:03,040 --> 00:03:04,576
What's out of bracket down here
58
00:03:05,344 --> 00:03:07,648
If you're going to use this ontriggerenter2d
59
00:03:08,416 --> 00:03:10,464
We actually need a box Collider
60
00:03:10,976 --> 00:03:14,816
On this gate that is a trigger ok
61
00:03:15,584 --> 00:03:19,680
Not only do we have this polygon Collider that actually stops the player
62
00:03:20,192 --> 00:03:21,984
It's not a Trigger
63
00:03:22,752 --> 00:03:28,896
We also want a trigger on here as well so we can literally just add another Collider a box Collider 2D
64
00:03:29,920 --> 00:03:30,944
And this one
65
00:03:31,456 --> 00:03:32,992
Is going to be a Trigger
66
00:03:34,528 --> 00:03:36,064
The size
67
00:03:36,576 --> 00:03:37,856
A little bit bigger
68
00:03:38,112 --> 00:03:39,136
Say something like this
69
00:03:40,416 --> 00:03:41,184
Alright
70
00:03:41,952 --> 00:03:43,232
Does go back into a script
71
00:03:44,256 --> 00:03:46,048
Create an if statement
72
00:03:46,560 --> 00:03:47,328
If
73
00:03:48,352 --> 00:03:49,376
The collision
74
00:03:49,632 --> 00:03:52,704
There you go here which is a collider2d variable type
75
00:03:53,216 --> 00:03:54,496
If collision
76
00:03:54,752 --> 00:04:00,128
Die gameobject die name = player
77
00:04:02,176 --> 00:04:04,480
Debug.log
78
00:04:05,760 --> 00:04:09,856
I'm triggered by the player
79
00:04:11,648 --> 00:04:14,208
I say that out and
80
00:04:14,464 --> 00:04:16,256
Can't we just testing to see if it works
81
00:04:18,047 --> 00:04:20,607
Again the player is going to
82
00:04:20,863 --> 00:04:22,143
Stop
83
00:04:22,911 --> 00:04:27,007
Moving because there is actually a polygon Collider here that could have stopped the player
84
00:04:27,263 --> 00:04:30,335
There's also a trigger here this box Collider Trigger
85
00:04:31,103 --> 00:04:32,639
Set to true
86
00:04:33,407 --> 00:04:34,687
That's going to be
87
00:04:34,943 --> 00:04:39,807
Used by the gates script to check and see if the players trigger in within this zone
88
00:04:40,575 --> 00:04:43,647
So if it doesn't make sense that s*** play here and hopefully
89
00:04:43,903 --> 00:04:45,695
Make a little bit more sense to you
90
00:04:46,719 --> 00:04:49,023
Alright time exploring
91
00:04:49,535 --> 00:04:52,863
I'll be fighting enemies listening to call music
92
00:04:53,119 --> 00:04:59,263
Right now it's pretty so it's getting on and there we go I'm triggered by the
93
00:05:00,031 --> 00:05:00,799
Perfect
94
00:05:01,311 --> 00:05:04,127
Then we can do it again and again so there's no one there
95
00:05:04,895 --> 00:05:05,919
You should go to to
96
00:05:06,431 --> 00:05:08,223
Play music
97
00:05:08,991 --> 00:05:12,063
This message has happened to three times now
98
00:05:12,319 --> 00:05:14,879
Perfect silver trail player
99
00:05:15,135 --> 00:05:16,159
That's great
100
00:05:16,927 --> 00:05:21,535
So now we need to do one more thing we need to check and see
101
00:05:22,047 --> 00:05:23,071
Is the player
102
00:05:23,327 --> 00:05:24,607
Has the key
103
00:05:25,631 --> 00:05:28,447
So what we're going to do some pseudocode here
104
00:05:28,703 --> 00:05:31,519
If the player inventory
105
00:05:31,775 --> 00:05:33,823
Has he won
106
00:05:34,335 --> 00:05:35,359
Then
107
00:05:35,615 --> 00:05:36,895
Destroy Me
108
00:05:38,943 --> 00:05:42,015
How do we check if the player has key won
109
00:05:42,271 --> 00:05:44,063
Let's go back to the new players script
110
00:05:44,575 --> 00:05:47,135
And take a look at our inventory item scripts
111
00:05:47,647 --> 00:05:53,023
Leave her now dictionaries contain a functionality called contains key
112
00:05:53,535 --> 00:05:55,839
So we could actually write something like
113
00:05:57,887 --> 00:06:01,471
Inventory contains key
114
00:06:01,983 --> 00:06:04,031
NN whatever that key is
115
00:06:04,287 --> 00:06:05,311
That's the
116
00:06:05,567 --> 00:06:07,615
We were going to write this ok
117
00:06:07,871 --> 00:06:10,943
Remember we need a reference to the new player
118
00:06:11,711 --> 00:06:12,479
So
119
00:06:12,735 --> 00:06:15,039
The way that we would write this out is if
120
00:06:15,807 --> 00:06:19,135
Game object that finds interest because will clean it up in a bit
121
00:06:19,391 --> 00:06:24,511
For now just bear with me if gameobject that find player
122
00:06:25,791 --> 00:06:27,327
Getcomponent
123
00:06:27,583 --> 00:06:28,607
New player
124
00:06:30,143 --> 00:06:32,191
Even Tory died
125
00:06:32,447 --> 00:06:33,983
Contains key
126
00:06:35,263 --> 00:06:41,407
Key1 and it's not saying contains an actual like key that you unlock a door
127
00:06:41,663 --> 00:06:44,991
What does the saying is it contains a dictionary key
128
00:06:45,247 --> 00:06:51,391
Meaning of the word Tiguan boot or gloves or sore
129
00:06:51,647 --> 00:06:53,951
Or trophy or gem key
130
00:06:54,463 --> 00:06:57,791
Just going to look for all of the various keys
131
00:06:58,303 --> 00:07:01,119
Or entries in the dictionary item
132
00:07:01,375 --> 00:07:02,399
If I find it
133
00:07:02,911 --> 00:07:03,935
Then
134
00:07:04,703 --> 00:07:05,983
All it's going to do
135
00:07:07,263 --> 00:07:08,543
Is destroy
136
00:07:09,311 --> 00:07:11,871
This game object in what is this game object
137
00:07:12,127 --> 00:07:12,895
Is this gate
138
00:07:15,967 --> 00:07:17,503
So that should do it
139
00:07:18,527 --> 00:07:20,575
Let's see if it actually works ok
140
00:07:21,599 --> 00:07:23,135
Does double check here
141
00:07:23,391 --> 00:07:25,439
If we actually zoom out
142
00:07:26,463 --> 00:07:28,511
And select the key here
143
00:07:29,791 --> 00:07:32,863
Noticed how the inventory string name is not he won
144
00:07:33,119 --> 00:07:39,263
She always want to double check and make sure everything's matched up remember we created the little smile inventory the real change
145
00:07:39,519 --> 00:07:43,359
Key wine in the morning to change the inventory Sprite to inventory key
146
00:07:44,639 --> 00:07:45,407
Say that
147
00:07:45,919 --> 00:07:52,063
Swords testicel first let's go over to the door and see if it actually opens
148
00:07:53,599 --> 00:07:55,391
When we don't have the key
149
00:07:56,671 --> 00:07:57,183
Good
150
00:07:57,695 --> 00:07:59,231
Just triggering it
151
00:08:01,535 --> 00:08:03,327
That's expected
152
00:08:04,095 --> 00:08:05,887
Programme de quillan
153
00:08:06,143 --> 00:08:07,423
See what happens
154
00:08:08,447 --> 00:08:10,239
Alright I've got the key
155
00:08:10,495 --> 00:08:12,543
It's showing up in my inventory that's good
156
00:08:13,567 --> 00:08:15,615
What's the other day actually open the gate
157
00:08:16,127 --> 00:08:22,271
Did awesome so we are good to go to the next level alright at least that's how old function
158
00:08:22,527 --> 00:08:26,367
In our prototype we will be able to go to the next level after we got the key
159
00:08:27,903 --> 00:08:30,719
Remember guys when you're creating scripts
160
00:08:30,975 --> 00:08:34,303
You want them to be as broad engineering as possible
161
00:08:34,559 --> 00:08:38,143
So far our Gate Script if we open that up
162
00:08:39,167 --> 00:08:40,959
A very specific here
163
00:08:41,215 --> 00:08:42,751
Is looking for key wine
164
00:08:43,007 --> 00:08:46,335
Well what if we want to have multiple Gates with multiple keys
165
00:08:46,847 --> 00:08:47,871
Are we going to do is
166
00:08:48,639 --> 00:08:51,967
Create new variable appear serializefield
167
00:08:52,479 --> 00:08:54,271
It's going to be a private
168
00:08:55,295 --> 00:08:56,063
String
169
00:08:56,575 --> 00:09:00,159
Anything to be called required inventory
170
00:09:03,231 --> 00:09:09,375
About required inventory item string just so extra clear on what this variable requires
171
00:09:10,655 --> 00:09:12,447
Ok we can just copy that
172
00:09:12,703 --> 00:09:14,495
Just paste it right here
173
00:09:15,519 --> 00:09:21,663
And it's going to look for whatever we specify right by The Fall it's going to be
174
00:09:21,919 --> 00:09:22,943
Display
175
00:09:23,711 --> 00:09:25,503
So we need to go into unity
176
00:09:25,759 --> 00:09:27,039
In Spotify
177
00:09:27,551 --> 00:09:28,831
Inside of this gay
178
00:09:29,343 --> 00:09:33,183
What word requiring well requiring key one
179
00:09:34,975 --> 00:09:36,255
Say that out
180
00:09:36,511 --> 00:09:37,279
And
181
00:09:38,559 --> 00:09:40,607
Alright looks like it works
182
00:09:41,119 --> 00:09:44,191
This allows us to create multiple Gates
183
00:09:44,447 --> 00:09:45,983
So if I take this gate here
184
00:09:46,495 --> 00:09:50,591
Remember if I make changes to a prefab in the actual seen here
185
00:09:51,103 --> 00:09:55,455
I need to make sure that I save these changes to the prefab
186
00:09:55,967 --> 00:09:58,783
I added this case grape that out of the box Collider
187
00:09:59,295 --> 00:10:02,892
Remember if we have a prefab that we make changes to in the actual sea view that are going to be applied
188
00:10:02,893 --> 00:10:04,434
Subtitled by
-♪ online-courses.club ♪-
We compress knowledge for you!
https://t.me/joinchat/ailxpXoW3JVjYzQ1
189
00:10:05,695 --> 00:10:11,839
Prefab itself the root prefab so say drag this gate here may be right there
190
00:10:12,095 --> 00:10:16,703
No it's only got a polygon Collider on it and it doesn't actually have the gates Krypton
191
00:10:17,727 --> 00:10:22,335
We need to make sure that we go to the gate that we were just heading
192
00:10:23,359 --> 00:10:29,503
And go here and this is going to allow us to apply all of these changes
193
00:10:29,759 --> 00:10:31,295
To that route prefab
194
00:10:31,807 --> 00:10:35,647
Here we go it's a now we can put a gear or here
195
00:10:36,415 --> 00:10:37,695
And
196
00:10:37,951 --> 00:10:44,095
We could have a require something else right would you have a require and I know a pumpkin and weak
197
00:10:44,351 --> 00:10:47,679
Maybe two of them right to these pumpkin Gates
198
00:10:48,191 --> 00:10:51,007
Requires you to have a pumpkin and then we could maybe
199
00:10:51,263 --> 00:10:54,591
Put something special on here right I maybe you could put in here another key
200
00:10:57,663 --> 00:11:00,223
And this would be you know
201
00:11:00,479 --> 00:11:02,783
The master key writing
202
00:11:03,295 --> 00:11:05,087
And then you can change it to be
203
00:11:05,599 --> 00:11:06,623
Gold
204
00:11:06,879 --> 00:11:12,767
Sonos help just by adding a simple Gate script with some inventory functionality
205
00:11:13,535 --> 00:11:19,679
We seriously created in entire game loop it's really amazing housesimple creating a core game repairs
206
00:11:20,703 --> 00:11:26,079
Ok so we have this gate here no that's how it's got some weird layering issues
207
00:11:26,847 --> 00:11:28,895
Well we could have drag it blow
208
00:11:29,151 --> 00:11:30,431
Round one
209
00:11:30,687 --> 00:11:33,503
There we go Sonu layering issues there
210
00:11:34,783 --> 00:11:37,855
One more thing we need to do for this gate before the
211
00:11:38,623 --> 00:11:39,647
Script is complete
212
00:11:39,903 --> 00:11:42,719
We seem to make sure we remove it from the inventory
213
00:11:42,975 --> 00:11:45,023
Meaning remove the key from the inventory
214
00:11:45,279 --> 00:11:46,559
So I'm going to do is
215
00:11:47,071 --> 00:11:53,215
Gameobject find getcomponent new player copy this reference here and we'll talk about how I can clean this up
216
00:11:53,471 --> 00:11:54,751
In the Future episode
217
00:11:55,519 --> 00:12:00,127
Remember that function we wrote remove inventory item there we go
218
00:12:00,639 --> 00:12:02,431
Emirates going to remove it
219
00:12:04,223 --> 00:12:06,271
Required inventory item string
220
00:12:07,295 --> 00:12:12,671
And if you go back to a new player here if you recall when we remove that inventory item
221
00:12:12,927 --> 00:12:15,999
It's going to remove it from our inventory dictionary
222
00:12:16,255 --> 00:12:17,791
And then it's also
223
00:12:18,047 --> 00:12:19,839
Going to set it back to blink
224
00:12:20,095 --> 00:12:21,631
Test out
225
00:12:22,143 --> 00:12:23,167
See how it works
226
00:12:28,287 --> 00:12:29,567
Rocky
227
00:12:31,615 --> 00:12:32,639
And
228
00:12:34,943 --> 00:12:38,783
We remove the key from the inventory and destroy the door
16631
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.