Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
So what makes a game a game is well preventing the player
I'm doing something and then having them actually able to accomplish something
Because they completed that challenge I mean that's pretty obvious right so let's Create something called
Date
He wasn't actually going to move this down and
Recreate some or Land Rover here
How much is grab one of these grounds and paste it
2
That right here and drink a little bit this going to be a gate
And then we'll take this
Delicious cafe in
Again can bring it up here so there's a gate to enter a new Zone and let's just put
Here as well
Beautiful writing
Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1
This gate can only be
Cast if you have a key
Ok
So we're going to do as we're going to first and foremost
Let's make this gate
I'm out just wait for now
And that sort of
Links
The store to the key here
Ok
So we need to be able to check to see if the player has an inventory item
If they do
Then the gate what automatically open right
So let's make sure that this ground that we copied and changed a little bit
What causes gait
And it's put it in our prefabs
It'll be an original prefab
Perfect by the way guys if you're getting errors while you're working on this
Will eventually need a cleaning job but they're actually not causing any problems so
Clear this out for now
Skate here
Create a new script
That will do something if the player has
Inhibitory item so it creates a new c-sharp script
Weird colours
Gate
Again if you get weird there's like this it's just part of the course with unity
I'm not cleaning up eventually but I don't worry about him right now
A m dragon will be here
And working at
Agate script
A select in the gate to dragon Andover
Now currently do anything because we open up the Script
It's nothing so what we're going to do
Is there actually going to create a new on trigger enter
Auction
Remember that one that we had for a collectible here
On trigger enter 2D
What is going to use this same sort a function for the gate
So ontriggerenter2d
Do something
What's out of bracket down here
If you're going to use this ontriggerenter2d
We actually need a box Collider
On this gate that is a trigger ok
Not only do we have this polygon Collider that actually stops the player
It's not a Trigger
We also want a trigger on here as well so we can literally just add another Collider a box Collider 2D
And this one
Is going to be a Trigger
The size
A little bit bigger
Say something like this
Alright
Does go back into a script
Create an if statement
If
The collision
There you go here which is a collider2d variable type
If collision
Die gameobject die name = player
Debug.log
I'm triggered by the player
I say that out and
Can't we just testing to see if it works
Again the player is going to
Stop
Moving because there is actually a polygon Collider here that could have stopped the player
There's also a trigger here this box Collider Trigger
Set to true
That's going to be
Used by the gates script to check and see if the players trigger in within this zone
So if it doesn't make sense that s*** play here and hopefully
Make a little bit more sense to you
Alright time exploring
I'll be fighting enemies listening to call music
Right now it's pretty so it's getting on and there we go I'm triggered by the
Perfect
Then we can do it again and again so there's no one there
You should go to to
Play music
This message has happened to three times now
Perfect silver trail player
That's great
So now we need to do one more thing we need to check and see
Is the player
Has the key
So what we're going to do some pseudocode here
If the player inventory
Has he won
Then
Destroy Me
How do we check if the player has key won
Let's go back to the new players script
And take a look at our inventory item scripts
Leave her now dictionaries contain a functionality called contains key
So we could actually write something like
Inventory contains key
NN whatever that key is
That's the
We were going to write this ok
Remember we need a reference to the new player
So
The way that we would write this out is if
Game object that finds interest because will clean it up in a bit
For now just bear with me if gameobject that find player
Getcomponent
New player
Even Tory died
Contains key
Key1 and it's not saying contains an actual like key that you unlock a door
What does the saying is it contains a dictionary key
Meaning of the word Tiguan boot or gloves or sore
Or trophy or gem key
Just going to look for all of the various keys
Or entries in the dictionary item
If I find it
Then
All it's going to do
Is destroy
This game object in what is this game object
Is this gate
So that should do it
Let's see if it actually works ok
Does double check here
If we actually zoom out
And select the key here
Noticed how the inventory string name is not he won
She always want to double check and make sure everything's matched up remember we created the little smile inventory the real change
Key wine in the morning to change the inventory Sprite to inventory key
Say that
Swords testicel first let's go over to the door and see if it actually opens
When we don't have the key
Good
Just triggering it
That's expected
Programme de quillan
See what happens
Alright I've got the key
It's showing up in my inventory that's good
What's the other day actually open the gate
Did awesome so we are good to go to the next level alright at least that's how old function
In our prototype we will be able to go to the next level after we got the key
Remember guys when you're creating scripts
You want them to be as broad engineering as possible
So far our Gate Script if we open that up
A very specific here
Is looking for key wine
Well what if we want to have multiple Gates with multiple keys
Are we going to do is
Create new variable appear serializefield
It's going to be a private
String
Anything to be called required inventory
About required inventory item string just so extra clear on what this variable requires
Ok we can just copy that
Just paste it right here
And it's going to look for whatever we specify right by The Fall it's going to be
Display
So we need to go into unity
In Spotify
Inside of this gay
What word requiring well requiring key one
Say that out
And
Alright looks like it works
This allows us to create multiple Gates
So if I take this gate here
Remember if I make changes to a prefab in the actual seen here
I need to make sure that I save these changes to the prefab
I added this case grape that out of the box Collider
Remember if we have a prefab that we make changes to in the actual sea view that are going to be applied
Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1
Prefab itself the root prefab so say drag this gate here may be right there
No it's only got a polygon Collider on it and it doesn't actually have the gates Krypton
We need to make sure that we go to the gate that we were just heading
And go here and this is going to allow us to apply all of these changes
To that route prefab
Here we go it's a now we can put a gear or here
And
We could have a require something else right would you have a require and I know a pumpkin and weak
Maybe two of them right to these pumpkin Gates
Requires you to have a pumpkin and then we could maybe
Put something special on here right I maybe you could put in here another key
And this would be you know
The master key writing
And then you can change it to be
Gold
Sonos help just by adding a simple Gate script with some inventory functionality
We seriously created in entire game loop it's really amazing housesimple creating a core game repairs
Ok so we have this gate here no that's how it's got some weird layering issues
Well we could have drag it blow
Round one
There we go Sonu layering issues there
One more thing we need to do for this gate before the
Script is complete
We seem to make sure we remove it from the inventory
Meaning remove the key from the inventory
So I'm going to do is
Gameobject find getcomponent new player copy this reference here and we'll talk about how I can clean this up
In the Future episode
Remember that function we wrote remove inventory item there we go
Emirates going to remove it
Required inventory item string
And if you go back to a new player here if you recall when we remove that inventory item
It's going to remove it from our inventory dictionary
And then it's also
Going to set it back to blink
Test out
See how it works
Rocky
And
We remove the key from the inventory and destroy the door
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.