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
With our activity built we need a way of
Giving it to the player as a reward for levelling
So
Let's go out and do that the first thing that we could do is go into our player scene
And you can again open up the scene with control shito inserting play or click into it from
Main scene here
And it's going to delete the Acts of biliary control
From there
Perfect
So now we will that start with the axe ability will need to acquire
Through the level up process
How we going to do
Well if we look at our upgrade
Manager
So go ahead and open up the upgrade manager scene
Click into the script and you can see that what you've got
Upgrade pool right here
And we are choosing an upgrade and passing in to this upgrade screen setup
Body upgrades
So your car there
The upgrade screen will display a number of upgrades essentially referencing ability upgrade which is a Reece
Subtitled by online-courses.club We compress knowledge for you!
What's a custom resource that has a couple of experts
So this is called ability upgrade but I think it makes sense to use this and extended
For new abilities as well so at the end of the day
Everything whether it's
An explicit upgrade for an ability or whether it's a new ability can all be considered ability up
So let's go ahead and create a resource
For the accessibility
I'm going to go into my resource
Directory in my
And then I'm going to go into the upgrade
Answer Direct
And I'm going to take this sword right here I'm going to right click it and then
Duplicate
I'm going to name this asks instead
Now if I double click on the apps you can see the
I've duplicate
Aldi's pop
But we actually don't want that rights
We're gonna replace all day so for the ID
Let's go ahead and right
Just playing Old Axe in there
And then we're going to
Type in a name as actual the capital
And illustrate is short description and it can be whatever you
Hammerite periodically
Sends out a spinning app
Say something like that
And so we can look at her sword and we can see that we are sorted now and we have our
Let's go back to her upgrade manager script by clicking the Script button in the upgrade manager scene
And now we have to choose more than one upgrade from the upgrade pool
Another thing that we have to consider is that
We might have unique upgrades
Or operator can only be chosen ones
So once we choose the accessibility
You probably don't want to be able to
Again
I want more handle that later
Let's go
More than 1 upgrades
Being chosen
A time there was a more immediate problem facing a
And that is that
We don't want the same upgrades to be chosen twice
When we are generating the upgrades to show on the upgrade screen
So what you need to do a bunch of array manipulation here
To get this working the way that we were
So let's do this
Let's create a new function
I'm realising that this is slightly out of order
Compared to our preferred order of function symmetric
Cut this on level up funk
And I'm going to move it to the bar
Because again I personally like to leave all of my signal handler methods
At the bottom of the Script
And everything else
In the middle
Create a new function
Just below the apply upgrade called
Pick up
Here is one minute
Let's do a for Loop
4
I in
2
What is right path
So this is saying working at used to up
Now in order to avoid the situation where we pick two of the same upgrade
What do I need to filter
The array
After every upgrade we choose
So that we
Exclude any other
For the same ID
Create a new variable under pick upgrades and we'll call it bar
Filtered upgrades
Is equal to
And we're going to copy or upgrade
Upgrade pool
Start
Duplo
And so what upgrades Poole duplicated going to do is this Returns a new array
With the same elements inside
In why do we need to do that because when we start filtering this array
We don't want to affect the original upgrade pool
So what you been appealing this filtered upgrades array
And because it is a copy
Therefore a different reference
We're not going to be affecting the original upgrade porter at all
If we don't use this we would actually completely mess up
Are upgrade to
And
It would break a lot of stuff
So
We're grabbing a copy of the Opera jewellery
Call filter
Upgrades and what we're going to do is copy this first couple lines in on mobile
So where were choosing the upgrade
And then checking well
It's no wishes copy all that
Or car trailer soul Control x to cut
Emily does excess layer
Then go ahead and
Paste those lines in a for loop and fix the indentation so one level of indentation
And we actually don't even need
Upgrade eagle Knowles or just going to remove
Dad's
Ok we got this error down here so we're just going to ignore that for now We Are Go
To be handling that
Momentarily
So in here instead of picking from the upgrade pool with an R4
We're going to pick from the filtered upgrades
Ok so now here's where the cracks of what we're doing comes in
So get the Chosen upgrade will do something with this and a little
The first we want to save filtered upgrade
Filter
And we can
Filter and Method using a method we can actually define an inline filter functions we can say
Funk
Upgrade
And then what we want to do is Wendy
Function in here Returns true
That means keep the
So let me backup
Filter will iterate through every single element in this filtered upgrades array
And it will run the supplied function again
Every single
And this is why I upgraded in here
So
For each element in the array
The upgrades being passed into the Senate
Action here and if we return true
Dysfunction
Then
That element gets to stay in the filter upgrade
And if we return false that
Gets filter
So what do you want to do we want to return
Upgrade
I D
Is not equal to
Chosen upgrade
So what is this filter function saying it's saying
Where choose Britain
We're going to take her children up
And we're going to return
Every upgrade in the filter upgrades list
That does not share the idea of the Chosen
In other words
Pick every element that is not
The same as the Chosen
And so there's filtered upgrades this filter
This actually Returns
A new array according to the documentation and if you want to take a look at
What you can do as you can control hold ctrl and click on filter
And that will take your right to the documentation
This is Returns a new array
And since this Returns a new array we have to assign the result
So we're going to say
Filter upgrade
Is equal to
Upgrade
So this filter Returns a new array with all the elements sorted out that we are specifying with this function inside
And then you alright we're just going to overwrite the value of filtered
And so now you can see when it goes to the next iteration in a for Loop
Is noted upgrades now is going to be
Upgrade pool
Essential it's going to be equal to the upgrade Paul -
Whatever upgrade was chosen in the last Italy
And we can extend this out indefinitely assuming that we had enough upgrade right we could say
Do that 100 times and keep whittling down
The filtered upgrades so that we're not picking
Betfred
Ok and then at the end what we can do
Is we have to return our children up right now or not actually keeping track of those anywhere
So what I'm going to do as I'm going to create a new variable via chosen
Upgrades
And then we're going to initialise at when empty array using open and close bracket
So this is an empty array representing art show
Cribs and then what I'm going to do is I'm going to add
That shows in upgrades inside a for loop into that erase so we're going to say chosen
Upgrades plural
A pen
Chosen
Up
So adding each other that we choose and and remover
From the filtered array
And then we can return
The end our chosen
Operates
Perfect
So now what we can do
Is we can
In the on level up function
Underneath the Anne child
Let's go out and save our chosen upgrades
Is he going to pick
Upgrades and will involve that
And then we can replace this array here
The single element inside of a dead no longer exists working to replace that with chose
Open up a new line here
Just to keep the 2 line spacing between each function
And now the final thing to do is in our upgrade manager we have
There's up
Play Paul
Property let's click that array let's increase the element size by one so we have another empty slot
What's bring over the axe into that's
Ok let's Run the game and see if that upgrade the X up
It's present
So I'm just going to go ahead and
Collect one Vial here
Yeah we got a crash and why did we get it
Ok so I think there's a type mismatch here
Subtitled by online-courses.club We compress knowledge for you!
And I think that we can resolve this by going
2 hour pick upgrades function
Dad
Specify type for a chosen upgrade by do
Colwyn array
Ability
Ok
What's going on in Run the game again with that type specified
And see if that
Ok so after adding that type we now have it working and you can see that I've got the axe
Specified here
Alongside the sword quickest and those are the only two arrays or those are the only two upgrades are there we have
I'm going to go home quickly
And nothing's going to happen why because we haven't actually built
Any code
Handling
The axe
The way that were going to handle adding that ability to the play
Is we're going to extend our ability upgrade
Script oh little
So there's a couple of ways you can do this I'm going to show you how you can use
Inheritance
2
Create a set
Resource
That has one additional Prague
So let's
Create a new script
In our filesystemresource
Upgrade
Older
So right alongside
These upgrades
And let's create a new
Skip
Unless just call
What does call ability simply perhaps that's not the best name boulders called ability dungeon
And what we're going to do is really have this extend
Ability upgrades
So I can I replace it stands with a bill
Upgrade up
And then we're going to add another export variable
And we're gonna save our ability
Controller scene
Type packs
So now it's
Double click RX vs here
And we have it set to use the ability upgrade GD
Alexis Ted wragg the ability over instead
And look what happened
So we get all the property
That are specified in a built-up
Alongside
The new property that we
Specify
Here
And I'm going to give us a class name as well someone is a class underscore the name
Ability
Ok so
Nrx
Trys
Let's go ahead and drive
Over
The act
Control
Let's search for file system X
We got the ability controller here
So I'm just going to drag it over and put it right
So now able to Oasis
The actual scene that gives the player this ability
With this resource
So how is this going to work there
Well
We're gonna go work player
And we have our ability manner
Here
So I'm going to
Open up a play script
Let's grab a reference to that ability manager notes I'm going to do another on read
Bar
Ability
Manager
Is equal to
Dollar sign
Ability manager
And this is not actually an appropriate name for the Snowdon
I was originally envisioning at this would be a separate note eventually but I think it'll just meant to be a part of the playlist
I'm going to rename this note here
Two abilities instead
And then update
This
To ability
And she
This
As well
So just got everything renamed there
No big deal
So now remember we have a global game event
That is
When
An upgrade is charged
And if you need a refresher we can open up the game event
Scene
And see right here we've got signal ability upgrades added
And that passing in the ability upgrade as well as the current upgrade
Diction
Which tells us what quantity
So if I go back to my place
I can in the ready
Connect to
So
Just above the update help display
Invocation here
I'm going to see a game event
Dart
Ability upgrades
Dartconnect
And I'm going to call this on
Ability upgrades
Let's go down and edit the very bad
Bank on ability upgrades
And we have our ability upgrade
Which is of type ability upgrades
And then we have our current upgrades
Which is of type diction
No probably not gonna use
The current upgrades at all
But that's fine we still need to specify it so the single emission works proper
And so what we going to do well it's very simple so recall that
If I go back
To my ex that trys
So because of the inheritance that's happening
In this script disability
My accent trys resource
Is
Type ability upgrades and ability at the same time
It's both of those
Ability is the more specific version
Better to use ing
But it also shares all the properties and
Turn off the ability up
So something really cool that we can do
Is if I go back
Clearscore
I can check if this ability upgrade is and a bill
So I can say if
Ability upgrades
Is
Ability
And that means that I have a new ability and that
Property that we expose the disability controller seem proper
I will be available to
Right so
I'm actually going to invade this and
If not ability upgrade is ability to let me know
It's just a normal ability
I'm going to return
So let me know don't do anything there's nothing I can do with
With disability badge
Since I know that this is now if it makes a pass the statement it's now going to be a type of
Then I can simply say ok
We're going to take this abilities note that we grab a reference to
And then we're going to add child
Ability
Upgrade
Start
And this is called the ability
Controller
Seemed
And if this until Santa is not popping up with this autocomplete is not popping up
Then what we can do as we can say ability
Is equal to ability upgrades
As able
And now when I reference ability in here
I can now reference that ability controller seeing in my suggestions
And then we're going to call
Dart instantiation on
Excel
And so what were you saying is if the type of upgrade coming in from that's from a global signal
Is of type of Bill
Then I'm going to go ahead and and we're gonna instantiated
And then another instance as a child to our ability
And save all went well
We should be able to pick the axe and then have it start working
Tails reacts
And there goes
So that's how we add
Abilities 2-hour upgrade options
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.