Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
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
Let's create a new enemy type
To add some variety to the game
But also to provide us with the ability to increase the difficulty as
Game goes on
So once we implement this enemy type were going to
2
Amend our enemy manager so that it starts spawning the new anime type
As we get into the game
So go ahead and go to York any assets your child
And let's open up tilemap pack
Hairlicious take a look and see what enemies we want to introduce now
We probably should use an enemy that is slightly different than the right
So I'm thinking either
The spider or the dark wizard here I think the dark wizard would be
Find Dad
So let's choose
This guy right here
I'm going to go to the individual tiles directory and I'm going to scroll down until I
Find him
There's the wizard
Ok so that wizard is tile 011
Subtitled by online-courses.club We compress knowledge for you!
1.png
Win a drag that over into the file system in Cadell
And I'm going to rename this to
Wizard
Underscore
Ok and then under scenes
And then game object
Let's create a new folder under
And call it wizard
Underscore Enemy At The End just to be
Consistent with the basic enemy that we've got
Drag that wizard png into that wizard
Just like so
And then hit control and
Make it route type of military
Going to call this wizard
Anime
Then go ahead and save that with control as
Inside of scenes
Game ABT
Wizard enemy
Alright lads had control a and search for Sprite 2D we're going bad is right to die
Which is going to have a texture of The Wizard
Png
And then
Go to the office
Why
Hold control
And let's offset
That
Bye
Holding the left Mouse button down and outfield
And moving the mouse to the left
And an officer of -8 in white put the origin
Of the Sprite ad
The fee
So that's going to be good for our purposes
And then let's go ahead and institute of child seeing we want to instantiate
The health
And let me go to the basic enemy seem so ctrl shift o
Search for basic enemy
This health component is
The default
At 10
In so what I'm going to do is I'm going to
Pampers maxol at maybe do something like
Animal it's just write 30
And I move his health component up to be the first child
So I set the max health to be
30
And then let's go head in Standish
The death component underneath this
I move that below the health component
And then I dragged the health component node into that health compare
Property
An Ender Dragon sprite
Into the Dead
Spray
Ok so we need to look at our basic enemy we also need to add a hurtbox compose
And
And we need to make this wizard anime a based
Of character body to die
So
We made a mistake here
And that's fine
Because what we can do as we can right click on the root note
And then we can say change type
And then we can
The character body 2D
And our issue is fixed
So you can always change the root type if you want
Ok so now we need to add a collision shape which represents
The shape that will collide with the train
And in our ship resource let's create a new circle
And lead set the radius down of that to something like 6 by clicking into that circle
An access 24
Yes and then
I'm going to hit w on the keyboard and just drive this up until the bottom of the circle
Is just touching the origin just like that
Ok
Click on the wizard anime l modified
The
Collision layers in the collision
So we don't want us to exist on a layer something uncheck that layer bit right there
Animal leave masks at 21
Which is the train
Leia
Ok let's instantiated another child seen in going to call this
Perkbox components
Instantiate a hurtbox component
And then
I'm going to put this above that collision shape 2D and then I'm going to add as a child another
Shape 2D
Just like so
And then we're going to cream
Again another circle shape
Let's move this hurt backs can't
By selecting
Sitting w on the keyboard
And then dragging clicking and dragging this
Into roughly the centre of the wizard
And I'm going back to the heart box compare
Collision
Opening of the shape resource
What's at the
Radius to 8
Yeah I think that's going
Just
Fine
So let's go back to a basic enemy and let's open up the script and see what kind of b
We have a very basic behaviour set
I'm here
Which is basically just moving towards a player at a
Givenchy
Rather than duplicated code I'm going to show you how we can
Make our movement code
Genera
And we're actually going to create another component for this
So let's take control in
And if that's not working it's probably because
You have
The Script editor
Contact
So always make sure that
One of these panels is in context
By clicking
Before you hit ctrl n
Anna let's Create the root type of
Note
And it's called this velocity
And I'm gonna go kind of fast food this but I am go
Wayne
What I'm doing to the best of my ability so
Let's
Go
And save this in our scenes
Component directory alongside of our other components
And I'm going out Ace
Default parameters are ok
We're going to create an export variable export via
Max underscore speed
And this is going to be of type
Result of
OK then let's
Create a
Function
Funk
Move
And it's going to accept an argument of caribou
And then that's going to be uptight
Character
Ok and say what we're going to do is we're just gonna right past right here
Because we need to keep track of a variable
Simon save our
Lhasa
Is eager
Vector2
0
Let's Create
Another function in here
I'm going to call it accelerate
In Direction
And our Direction is going to be
Type
2
That's right path
So the way that we're going to use it
Is we're going to be able to manipulate this internal velocity by cooling Accelerate indirect
And then we're going to be able to move the character by calling the smooth
Now why is
Is this good well if I go back to my basic enemies
Hear what I can do
Essentially is I can
Manipulate the velocity and comoving slide
From within
This
Component here
So I don't have to keep doing
The same code over and over again
Also going to
Prove our ability to control
How enemies move
By utilising this accelerate
Now we'll probably also going to want another function so let's stop this out I'm going to create another function call
Bank accelerate
2
Claire
Endless pass in
Well we'll keep
So what does keep no arguments
Ok so the first thing that we want to do
Is we want to say
The Folly
We want to say in our acceleration Direction
Scrap our desired velocity
And what is are desirable
It's going to be the direction
That were passing into the funk
X
Power maths
Speed
Right so this is the final velocity that we want
Tube
Then what we're going to do is we are going to
Accelerate
The current velocity
That desire
So what we can do
This we can say
Velocity
Remember this is our internal velocity
Is equal to
Velocity
Start
Look up and we want to live
Which is linear interpolate 2 / 4
I'm not going to use that framerate independent that we talk to you
So this is going to be 1 -
And then this is going to be some smoothing value so we'll say
What's a neg
Acceleration
X
And then we can use this
Get process
Ok so they don't want to break down
Before I break this down
Let's Create another export variable
Blow the man
Speed and call it via acceleration
And put a float
Ok so now alright should go away
So what do we do
Were using the linear interpolate which again
Take away
Which is what we're calculating here
And says I want to go this percent of the way
Sward
This
Supplied
So we're going to essentially go from my current velocity
To the desired velocity
This person
Everything
Now if we were to put something
Point one in here
We would say every frame
Ten percent
Closer
To the desirable
Now this is
10% according to the current
So you may notice if you're familiar with mass
Subtitled by online-courses.club We compress knowledge for you!
This is essentially an asymptote
Basically what's going to happen is it
Get 10% closer to your goal
Every frame
You're actually going to a pro
But never reach the desired velocity now in practical terms that Jacqueline
The case but in mathematics
Dad's
Insole
We don't want to provide a fixed value girl
10%
And the reason is because if you have a user running at 400 frames per
They're going to be going 10% closer to their goal every single frame
Rainbow
And if you have a user
Playing at 10 frames per second we hope that
Happen but if you have another player
Going at 10 frames per sec
They are going to arrive at the goal match Slough
Right it's all because
There can be different framerate
We want to
Introduced an early release
And basically we do
Is we take 1 -
And I like to use x
Energy
The only reason I'm using that is because it provides a
What about moral and natural feel too
And then we're supplying a
A power to raise
To which is
Some smoothing
Which is our negative
Get-process deltatime
I'm here
Will give you the value of Delta that is typically passed into
The process function here
This Delta
This Delta
Are going to be the same
As long as they are
Run
In the
Ok let's apply
Or supply whether a default acceleration value by giving it -5
Anna let's say them
Speed is equal to
14 actually sorry this is not supposed to be negative here that
5 because we're not getting it
SO53 acceleration and max speed of 40
As a
And you can see all these defaults appear now
My inspector be careful
Calculator.net
And then in our move function
Working a pass in a character body that we want to move and it's actually going to do is going to say
Character body
Velocity is equal to velocity
Then we can call
Character body
Darton
Moving slide
And then we need to re assign our Velocity
So that we can
Say update
The character bodies last Eso
Breaking this down
We're assigning the CO2 by blasty to articulated velocity
That's internally stored here
Were telling the truth about it to move and slide and again moving slide
Returns the remaining velocity after
Collision and then
Because that happening internal
The character body
What is not being updated in our Velocity
We just simply reassign our current velocity
To whatever the character body
Is after moving slow
Celtic
Doesn't collide with anything at removing slide
Then
These this last should be the same as the
Hopefully that all makes sense
And then let's do one final one which is accelerate
Two player
So what we going to do is going to say
Bar
What's a owner no to die
Is equal to owner as no Genie
And then we're going to say
Owner node 2D is
Then we're just going to return
Function
And the reason were driving the owner as a note to die is because we want to do the follow
We want to say
We want to grab the players position solovar player is equal to get 3
Get first node in
Claire
Claire is equal to null will just return
Ok and now we can calculate our directions save our Direction
Is equal to now remember when you want to calculate Direction into vector some track
But
The vector that you were
The point tour
Goes
So this could be player.dat global position
-
Moana
No Judy make sure to you
Owner no today
Global position
And we want to normalise this song
We're going to
Apprentice eyes that operation in then called that
Normal eye
And remember that the reason that we want a normalize a vector is because it returns a
Unit vector a vector of
One or mag
Sufferance
If I want to make a line
Pointing in a certain Direction
If I multiply that by a vector
Hasn't
2 then I'll actually end up with
And I don't want that so normalisation make sure that my vector my Direction
Has a length of 1 so that when I do multiplication operations on
It returns the result that I'm
So we normalise that and then we're going to do
Call Accelerate in Direction
With
Supplied
So this is essentially a helper function that would just look into
This funk
I'm here to update
Ok so we've got our belasi component build out
Before we go back to her
Let's
Go to our first and we that we created
Let's instantiated veloci
Drag it up
Around the default values here should be fine so that's good
So it's open a bar basic anime
Script here
We don't need this anymore so instead we're going to grab a reference to
That velocity components so already far
Velocity component is equal to
Elastic
And then in the process method we can simply call
Lastly compound
Dart xcelerate
And then what was this called this was called Accelerate to play
So that's what we're going to call in r
Crypto accelerator
Player
Ok
And then we can call velocity
Component that move and I'm passing the self because this is
So now we should be able to remove
These
Free call
And we can also remove this
And by the way there's no longer I need to have a rash
Health component in the sky
So what's going on remove
As well
Ok so we've simplify down at two lines and that's not really the strength
Pulling a Sandra of last week about the strangers
Now we can control the max speed and the acceleration
And we can make a wildly different numbers for different enemy types
And we have a nice or component that we can further extend with more functionality
That can then be you
Everywhere
So in order to make sure that we did everything correctly let's just Run the game and make sure that our rat enemy
Is still work
It's not
And I think I have a typo
Display align lives type that as known to die
And then let's remove this normalize and we should be
Ok
So it's called dot normalized with a d
So the typing is used for
Because
My player global position was not tight
And so good dog cannot
Give me hints about
What function I can call her
Because I didn't recognise this first
Piece of the subtraction as a no
But adding this as no 2D to the
Telescope
That's what it is and then
Everything is good so let's go ahead and Run the game again
And my enemy should still be moving now what your notice is Dad
The enemies now or a lot slower
Turn
And that's because we have an acceleration
Before we were just telling the enemy to go at max speed
In the direction that we said to go
And that made it like under the player much harder but watch what
If I go to my basic enemy here in I change my acceleration
Like .5 instead
What you going to see is at the enemies are very slow to read
To the
Exposition
So I can run past this
Look how long it takes for that enemy to change Direction at
Right
So the cool thing about this is that we can actually achieve
Prequel
Enemy behaviour
Buy just tweaking me stupid
So I can keep it .5
Turn the max speed up to 100 if I want
And then what
So now I've got all these enemies
Lying around now look these actually kind of feel like flying enemies
So we might use this combination of numbers
To make
Flying enemies to make it appear like
You know they have to fight against the air in a decanter return around that quick
You know it gives them some weight
And of course we can also turn the acceleration up a bunch
To essentially make them instantly respond
2
The changes in the player Direction like this enemies
Borderline under
So anyway
With just these two parameters I'm going to reset those by the
8 to 40 and 5 again
Was just us to parameters we can actually create a wide variety of
Any movement behave
And all it takes is just a c
Prescription
Ok
So with that detour and done let's go back to our wizard enemy
And let's go ahead and instantiate
Velocity component in the Wizard and I
Below the health campaign
And let's set the wizards max speed
To maybe something
Maybe something a little bit heart maybe
6
For the max speed
LS20 acceleration down to something
Now that this is we can go our main seem open up the enemy manager here
What's going on
That scene
This basic enemy seem right here we're going to have to change all of this
I'm just going to drag
My wizard anime scene on today
First
And then go ahead and run it and see how they were
And the nice thing about this is that
We should be able to see what the enemy looks like so the enemies not me
And the reason that is not moving is because we have
Add Script To The my so it spawn incorrect
Let's go out back door weather in
Add a script to the route no
Let's create an override of
Process
And I'll try pass in there for now
A couple on ready variables and I want you to think what do we need to do
In order to make the enemy move
What how do we vote
We do need a grab
Reference to the last
So let's go out and do
Bar Brasserie komponen
I would encourage you
Also too
Think ahead
About what we do
Try to you know even pause the video for a second
And just try to anticipate
What were going to be doing now
Because if you are
Only just doing everything that I say to do
You may find out less effective than trying to predict
What I'm go
Just we'll tip for you
Cheeky Panda
Anyway let's go ahead and go further
Elastic component disease
To you
Velocity
And Annie trick you can do as you can grab a note
With the mouse click and hold and drag
And if you drop the load in here It just gives you the short hand wrap
Let's do it in the sky
But if you start dragging it
And then you hit control
Hold control and then release
It would generate an on readystate
Oreo
So we can do that to be a little bit quicker now so I can say the last
Important
First
Then hold control
And there's are ballistic
Neat little trick that you can keep in mind
The process method what do we want to do
We want to say velocity component xcelerate
2
Claire
Ok and then we can save the last
Component
Rightmove
Cell
Let's go to our basic enemies
And let's copy this
Just like so
So there's move sign
Black radio
Bring a back over to the wizard anime script
Is that in there now if we really wanted to we could make another component for this
But I'm fine with just copy and pasting it everywhere
Ok let's create a new note under the wizard anime core
Note
Diesel into the Note 3
And then
Call this visuals and put it below the death component
And then drag the Sprite to the as a child of that
Note
And then let's go ahead
Created on ready reference to this by clicking and dragging the visual
Then holding control then dropping it
Get some now all of that should be worth
If we go back to our first basic
We can remove this get direction to player
Keeping the code clean is important because it's very easy for cold to come out
No you're not
That these scripts are essential for the same
And it may be tempting
2
Just create one script for the enemy there
Is this content
But I would caution you and
Doing that because then it becomes very hard
To create specific enemy behaviour
Which we might do
This is essentially a copy paste from the basic enemy however
We don't want to share scripts necessarily
Because that's going to be really
Limit our ability to
Implement unique enemy
So when the course is done you can feel free to consolidate these but
Let's keep them separate for
Ok so now it's Run the game Remember our enemy manager is spawning a wizard
And look at that
Ok so we have a couple of problems the wizard is bunching up on itself and it's facing the wrong direction so this is a copy paste
This is a great example of what I'm talking about
This
Visual scale
Move sign needs to be actually different than the basic anime.so
Remove the negative
From the Move sign in there
And that will fix it
And then we need to go to a route now here and change the layer that the enemy
And the layer we want
Is able
5 or sorry
4anime
So we don't want to exist on the train later but we do want the wizard to exist on the enemy collision
So that he collides with other enemies and doesn't Bunch up
Additionally we need to set the mass
To that as
So that it also
Oxford collisions on
Ok let's go back to a basic anime and we can see in the snow
Tab here in groups we need to add the wizard to the enemy group
Well so there's a lot of setup to do that we need to remember
Let's go to a wizard anime go to the new tab got a group
Right
Enemy in this
Text boxes in Annan
Just a little bit more said to go on this wizard we needed you two more things so the hurtbox component here needs are
France to the health camp
So that's good and rank the health component down
Intern
And then we need it in Stand should a child scene we need to instantiate a vile
I'm going to put that
Above here as well
Let's attach the health component to the cell component property as well so drag their health and put it over
Or this time I'm going to
A sign and double click the whole component
And then the drop percent
Let's make the wizard drops
.5
And let's go to a basic enemy here
And turn down the volume
This one too
30
5%
Right now it's Run the game and we should be able to kill a wizard so let's go ahead and see
If we can do so
And you should notice that
Our death
Component is working flawlessly
With that
So now we have
Free death animations
For every type of enemy by just building that
Component
Alright our wizard enemy has been implemented the next step is to make it so that
Game can spawn different types of Venom
As the game
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.