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
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
Russian
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
When our experience bar fills up we need to be a
To be presented with an option to upgrade our abilities or require new build
And so that's what we're going to be starting in this life
So what we going to be using for our upgrade
Is custom resource
And where resource is it's essentially a file
That
Hoards a bind
Cedar
So the idea is that we're going to be able to create about these resources
And then manually add it
Some ass
So that resource
Within the Ed
That we can done reference in code
And so you'll see how that works
Let's get into it so first let's go to the resources directory under our file system
Let's create a new folder underneath that
And cold
Upgrades
Right-click on up
Selection new
And then resource
And these are all the research
Is that we can
Use if we wanted to
Now we're not going to come anywhere close to using all these resources
Subtitled by online-courses.club We compress knowledge for you!
But you'll notice that we've actually you
If you are red
Sovereign Saints under the sheep to eat we've already created a circle
Shape 2D
And a rectangle
So these are actually resources as well
We've also been using textures across or Sprite 2D
Which are another type of
So resources basically anything that holds some
Data that can be passed or
What we're going to do is there any creative cost
Resource so are we going to do is double click the root resource here
And that's just going to give us a plane resource
It's called this
What's called
Sword
Underscore rate
And save
And have you got your upgrades for you should see that that's alright is there and you can double click
To see
That it will open up an inspector
Now we actually have
Done anything with this resource as a very bare bones
Boil notice if there's a script section right here
So we can
Attach a
2DS resource
To make them work that way that way
Time to work
And so what I'm going to do is I'm going to create a new script under upgrade so right click up
Create new
Script in the Script dialogue we are going to rename this new script you were going to call
Ability
Upgrade
Dodgy
Mobility underscore upgrade
Dodgy
What's going on in creator
What's double click to open
Ok so we're going to want to change this first line here we're going to write extended
Resource instead because we're going to be attaching the script to a resource not a no
Export a couple
Tips for going
Do at Expo
Name
And then this is going to be a type of string
Nice to another x
Bar
Description
And this is also going to be another string
Let's do another export as well
And this is going to be a bar name what's a bar ID
Ok so I'm just going to leave that as it is and then I'm going to go over to my sword read.to yes I'm
Double-click that again
And I'm going to drag the ability upgrade into the Script
And as soon as I do that you can see that
We've now got those three properties that we can
And there's one thing we can do to make our description a little bit more out of the ball is we can actually do
Export underscore multiline
To tell her that it should be a big heading box so you can see now
In the ability upgrade igd
We can see
A big description box and then we can click this button to bring up
Full screen
Text Window
This is night if you're going to be riding a lot of
As is the case
Description so with our sword rate so I could weekend
Go ahead and
Felony feels so let's
You sore
Underscore rate for the ID
And then our name let's say
Sword quickness feel frida name this heavy one
What we're going to do is going to write a quick description so I'm going to say
Increases
Sore
A tag
What's the Sea by
10
Of course maybe will change that number later but what does give it up bass
Description
So
As the description States were going to be making the
Ability upgrades
Change the speed
Are the swords attack
The thing about this is that this can actually be stopped
As well so we can present this
Upgrade to the player multiple times
As a way of upgrading
Disorder even more
And one final thing that we're going to do is let's go back door ability upgrades
And let's just call
Classname
Class underscore name ability
Upgrade
That's going to help quite a bit in the future so we're just going to a site
Neck last name
And it looks like we're good girl alright so let's create a new note so go ahead and go over to your scene dark
Hit control pen
To start a new scene
And then make it a route to
Of a plane no
Call days upgrade
Manager
Let's go ahead and save
In
Oursainsburys.co up to your room
Directory
And then in manager were going to save it alongside those
Ok
Add a script
Default setting
Should be just fine so we're gonna touch that
And in this upgrade managers
Let's go ahead and create an
Sport
And what we're going to do is really cold as far
What's upgrade pool
And then a colon were going to type it as an array of
Ability opera
So this is going to be
Our customer resource here we can export that as an array
In inspector
If you look at the inspector we now have an upgrade pool
Where we can edit this size
And elements so if I go ahead and increase the size or a
I can't click add element by 1
Or I can increase the size with this
Size
Spinner here
We want one element to exist
Then I can drag over our sword rate into
And so typing it as an ability up
Are allowed us to
Only drag over
Anything that
Has a class name of a billion inherit from a billion
Now
You note that if this is not working If You Can
Strike the sword rate over into here
You may need to restart your goodle editor this is a known issue at least in the version that I'm using
Which is rc1
You're probably on
4.0 stable
But again if that's not working just going to restart your editor and it should work
Ok so that's our upgrade Paul and we've got
Sore
Rate good girl
Serena go back to our main scene in switch on over bed
The 2DS
So we've got the experience manager lit open up the Script
So this experience manager
Responsible for
Incrementing the experience
And telling us States
Update
So I'm going to want to have a level up signal as well
So let's
What's this
Experience manager script
Never get another
Cigna
Leveller
Sandwiches
New underscore level
Chadderton
So we're going to pass in the new level
Two player just reached in the level up signal
And we're gonna make that here so again
Experienced updated first underneath this
Black in ink
Experience
Emma is going to go ahead and level up
And what are we going to
We are going to Amy
What's the current underscore
Level
So let's go ahead in our main let's instantiate a child scene
Instantiate upgrade manager
Garden products somewhere near the top with the other
Energies opera manager we probably want to connect to this level up so that we can actually a sign
An upgrade
The player
So what I'm gonna do is I'm going to click into the upgrade manager
And I'm going to export
A variable
I'm going to call it Xperia
Manager
Export that as no
And then we're going to override the ready method
Funk underscore
We're gonna say experience manager
Dad
Level up
So level underscore up.com
On level
What's define the on level up function
And remember working
Taking a level the current level as an Int
So on level up beginning with k
Rational problem that can be used
Just
But what are we going to do on level 12
Going to ideally show you I'm
But first let's just a sign
That
First upgrade that we have
To the player so we're going to actually create a new variable in here
Current
Underscore upgrade
Is equal to in regular use curly braces
Because we are defining a new dictionary
Now
If you're taking this course you're probably familiar with programming generally
But if you're not familiar with
Dictionary
Dictionaries are basically a way of assigning data to an AI
So if I were to go into my current upgrades here
And say 10
Hello
What will happen if I could reference
This value hello bye
Using the key
So in other words I can do something like print
Different upgrades and
Brackets
Test
And that would resolve to hello
This is just a nice way of
Storing data that easy to look
So we're going to just leave this empty this current upgrades
For now
Then I level up what are we going to do
Well here's what we're going to do to manager ok
Subtitled by online-courses.club We compress knowledge for you!
Replace Google restore all of the upgrades we have
In
A dictionary object
And we're going to key it bye
The ID
That we use
Here in our swords
So we're going to have sword right as our key
And then we're going to store the actual resource
In an hour
And actually we meet use a nested dictionary
Which will be really cool
Ok so what are we going to
So unravel
We're going to first
Pick a random upgrade from the upgrade pool and it's very easy so we're going to save our chosen underscore
Is equal to
Upgrade pool
Picrew
This is going to do is this is going to pick a random element out of that array
And it's going to be possible for pick a random to return now so would you say
Chosen upgrade is equal to now
You can say what how is that possible
Well
If we start removing element from the array in the future like let's say that we have unique
Upgrades that can only be chosen one
That could potentially end up you know if we exhaust all of the passport upgrade then we say there are no more upgrades
Then
You could potentially be trying to pick an element from an empty array
So it doesn't hurt to be defensive especially when it's really easy to do something like this
So the next thing that we want to do is we want to see
Does this current upgrade
Have a key that matches Archie
Upgrade
So what we're going to do is really save our has
Upgrade is equal to
Upgrades
Has
And in our has we're going to pass in
Chosen upgrade at
I D
Now we want to get typing as what we can do as we can say as ability upgrade right here
And now we should
H
Suggestions for ID
If not
Has upgrade
Then what we want to do well we want to say current upgrade
Anarchy it bye
Chosen upgrade
I D
Is equal to
We're going to create a nested dictionary in here
I'm not going the same
Is we are just going to
Store a reference to The Resource so resource
Is chosen
So this is our actual ability resource file
And this needs to be in
Quotes just likes
Serena pass in our children upgrade
At The Resource key
And then we're going to do in Cork
Quantity
And then we're just going to send it to
Ok so
This is basically saying
Create a new object at the key which in this case will be sorted underscore
And that object is going to have a reference to the ability upgrade resource
That we
Shows
And then it's going to set up
U2 One
Now watch what happened
If we say else
So if we already have this key in the dictionary what are we going to do
Bring us a current upgrades
Androgen index it by
Chosen upgrade
And I'm going to do another index here
Which is going to be
Quality
Classical
Oh sorry this is should be quiet
Quantity
So you're saying ok well
If we already have the upgrade we have at least one
That means that we can just increment the quantity
Bye
1
Ok just for debug purposes we going to write another line at the bottom
And then we're going to print a current upgrades
This is going to allow us to see
Our upgrades are actually working when the player levels up
So
This is not going to be the final stage we are going to introduce a UI with the player can choose an upgrade
But just to make sure that the upgrade is actually
The data flows actually work
We're just doing it directly for now
Let's Run the game
Because I forgot to assign my experience manner
So let's go ahead and go to my upgrade manager in my sim three
And leads
Drag the experience manager
Into that experience manager now that the
Ok so let's try this is
As I'm going to go ahead and collect
All these vile
Ok
So I just collected my face veil and levelled up let's go ahead and go over
2 hour hour
And you can see down here
Lad
Here's my object
So I've got my sword rate which is the ID of a resource
It is referencing a resource in memory
And has a quantity of 1
And you can see that while I've got the game on the other screen
That I just levelled up again and now the quantity is 2
So this is how I gonna keep track of all of our upgrades there each upgrade is going to have its own key
In this dictionary
And then we'll be able to keep track of how many times upgrade has been collect
And then what we're going to do is we're going to have to handle these upgrades in each individual ability
So that's the initial
That's required
Ability upgrades working I'm going to remove this prints
For now
Because we no longer need it
And in the
Next lesson
We are going
Go over
How do you actually choose this upgrade with a u
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.