All language subtitles for lesson133

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian Download
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Another really cool effect

In due in addition to particles

Is we can actually sort of knockback the player

If he gets hurt

So the way that we would actually achieve this

Is simply Be

Testing

Which side do players getting hit from

So if the player is getting hit from the right side

Not the player to the left right

And if you get hit from the left side from an enemy

Not him to the right like that

So how do we achieve this

Well we actually go inside of the attack box remember the attack box is a child of an enemy

Ok

Your call

I select this enemy here

The enemy has an attack box that's a child

It has an attack box script on here

What inside of a script we can actually write a simple

Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1

Condition

That will test which side of the player

We're on

I'm going to test that

Inside of the on trigger event

Ok

Once we get that information whether it's on the left or the right side of the player

We can launch the player in that direction

So

Let's go ahead and jump inside of the attack box script

How exactly are we going to figure out what side the player

Is being hit from

When Hitler visit at box

Well we're going to create a new variable

In a variable

Give me a serialised field

Tell your private

Integer is going to be cold target

Side

The weather in 4 words we could use here but your side makes the most sense to me

And this value was either be -1 or 1 - 1 left side in a positive

Dean the right side ok

And we can basically test

Which side

This attack boxes on inside of the ontriggerenter2d function

So what's a pseudocode to get an idea what this will be

If

I'm on

Pallidus if I'm

Add an exposition

That is smaller

Then what I'm attacking

Anasta col de collider2d right here

If I'm in a position that's smaller than that

Then I'm

On the left side and that's -1

Otherwise you lying here

Otherwise I'm on the right side

1

Alright then might sound a little bit complicated so just hold on here it's not actually that bad

I'm actually going to write a very simple condition here

That's going to translate the pseudocode into actual code

Now a lot of you who are a little bit more advanced than me in code

You might know of a very much more complicated yes simpler solution and it sounds like

But what I mean is there are plenty of ways to write code

Especially when using if statements that can be a lot simpler but it actually requires a little bit more

Complex understanding of just going to write the very simple version of this code

It's

If

My parent member the attackbox is actually a child of the enemy so if transfer

Transform

That position that x

If that position

Nex

Is smaller than

The collider2d that transformed opposition that x

Well then

I'm on the left side so what does that mean

Target side equals -1

Otherwise

My target side

Is positive one ok

So the reason why we see realised this is so that we can actually see it player in the editor so it's go ahead and tested

South square head in select this enemy here

In brexit I want to see

What the target site is for this attack box

When we play

Remember the attack box is a child

So that's why in r script using transform

The parrot here

Protesting

From the attack box

Testing to see

Where are the enemy in this the pain

Where is position is

Relative to the player

40 plate year

Ok

Securly is like the attackbox year

It said to target side of one

What happens when it hits the player on the right side it's going to stay at 1 right

Where was when I hit the left side

-1 c that

No it's -1

How many goes back to positive one

It's a player hits

On the right side

So what does that mean now we have the right information we need to send the player

In a certain Direction

And knock him back when he gets hurt

So they were going to do that is actually just go to a new player here and if you recall

Inside of a new player script

All that functionally happens in the heart function here

No currently we're only passing through an integer and that's attack power

So get up we're going to the attackbox here

This is the actual code that handles

Power hitting the player

As you can see here

When we hurt the player were sending in the attack power

Relative to this enemy

But we can also send through

The target side right

As you can see

We're getting there and that's because currently we do not have two parameters available to us

In the player hurt function

Got a new player here in adorama

An integer

Going to call it target side

So now that's going to debug in test this out debug.log

I'm getting hurt

On my side colon

And then

What eyesight is so just tested on

Go ahead play here

So if we get hurt hopefully in the console window is going to tell us which side we're going her on

Ok I'm getting her on my

Side

Whining at the right side

And then if you get hit in the left side

I'm getting hit on my side -1

Turn the left side

Information is being

Sent through

Desert function inside the player

So now the player knows which side he's getting her on

Or we can send the player in the direction ok

The way we're going to send the player in a certain Direction is really gonna create a new very

In a variable is going to be called Lodge

Essentially we're getting out of a cannon to some degree or shooting the player from his current position

Watching him

In the opposite direction that is getting hurt ok so we're going to create a new variable

And we go ahead and just put inside of the attributes here

And it's not going to serialise it's give you a private

Float on record March

My default is 0

Now we can put that value

Inside of a target velocity

Lying here

Remember the target velocity currently all this happening is the X value

Of our target velocity is determined

By the horizontal axis so when I'm pressing left or right key when I'm running

X r max speed value

Or we can also add

The launch value ok

And that means that if our launch is -1 the player is going to constantly move to the left

Or if the player gets hurt

On the other side he's can't so I'm going to move to the right ok so that's actually said the launch value

Turn the lounge values set to zero so

This is going to do anything

But if I scroll down in my heart function

And I say

Launch equals

Target side

It's going to move in that direction

How to be clear we want to make sure it's the negative target side because I get hit on my right side in

Is wine

I don't want the player to move to the right I want to play the move in the opposite direction

So negative

So if we said this

What should happen is the player should constantly move to the left or to the right

When

The player gets hurt

So test that functionality first

Premier player

Alright so I round to my enemies here I should constantly move their left

There we go

Just barely left and you can see this still happening here and that's because the large is currently searching

What ok

So that kind of works right

But there's one problem

And that is that the launch

Is

Remaining at that value

Set the mama we get hit it stays play It's -1 forever or one forever

The players always going to be moving and add some

Air resistance or friction to this value

This is actually one of my favourite lines of code to write and have been reading this code since I was

And I'm 16 years old and this is a code I don't know where I came up with it or how aware

Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1

I read it but

I use this code to smoothly was called lerp a value back to 0

So we can go from one

20 with this line of code so the pseudocode is

Burp or

Ease

The large value back to zero at all times

So we set the March to 1

When the player gets hurt it's going to smoothly go back to zero so that he only moves a little bit

So this will look confusing I promise you was going to look confusing and all I ask is that you trust me don't get

Next year and just I just try and memorise the way that we write this because I love writing this line of code

So what does Lana coders again it takes the large value back to 0

To the way we write that is we take a flow like lunch and we write plus equals

The value we want to go to zero

Miners are current value Lodge

We x x x at delta time because we're iterating right we don't want the

The movement in a learning to be depending on the frame rate of a computer

So we x x x out a time and then we're going to multiply that time so kind

Large recovery value

Just bear with me a minute right launch recovery

Well that float doesn't exist so it's Craig don't really

I know this is confusing just bear with me here

Launch recovery

Is it going to be a serialised field for the week and week in the editor

Alright so what the heck

Did we just write

Well

We want to launch value

To ease back 20

All the time so I get hit

If it goes if I get hit then moved to the right at a large value of 1

I want to cancel this right I wanted to go back to zero

So that is what this function here is

Just ignore this for now but we're x

And just think about this value here

Launch is iterating

Increasing

Bye

0

- the current large power right so if it's 1

Is going to increase by a very quick value

Analysis

Wine -1 so it's going to

Decrease

Amen because we just did that

The launch by is little bit smaller

And on every iteration the launch by get smaller and smaller smaller smaller smaller smaller smaller and he is

0

I don't require you to fully understand this

Just know that if you want something to learn smoothly back to 0

This is a great way

To write that out again

Your float value iterated so plus equals

And you do apprentices in on the left side of the princesses you do where you want to go

And then you subtract by your current value

Then you just multiply

Buy timedelta time you always do that when you're eating a value

And then you x x some kind of friction value or a recovery via Sunday night

Was slow it down or speed it up depending on the value strength ok

Again I know this is confusing

So let's just has to sell

And see what happens

What's going on inside your player here and just make sure that our values are showing up as you can see the value of launch recovery is curry

0

What set it to

Wine and see what happens

Player gets hit

Alright so you can barely see it's really hard to tell

Let's go ahead in change

My value give me something a little bit bigger

Because currently he's just not moving that much so it's really hard to tell what's going on

Touching back in your script here

And let's go ahead in make this launch value

Bigger than -1 or positive 1 curly it's going to be as big as the target side which is

Value of 1 x x

Times of value

We can multiply x 10

25 something like that or we could play a lot

Power

No you

How to make a new vector to so that we can have a power in the Y Direction

In the extraction and right now we're only going to worry about the launch Power that x

That doesn't exist right so just roll up

And what will you do

Is just credit voucher serializefield

Can I be a private vector to Ennis going to be called Lodge power

Ok

Ok so if you go back in the unity could a player here

You can see you can see that our launch Power is currently set to 0

In the extraction in why worry about the Y Direction right now

But currently let's just worry about the extraction so let's make it a value of

Annabelle

10 ok

So now we have a large power of ten to the players going to fly pretty far

And because that launch value

Is going to iterate back to 0 with a large recovery value of 1

It slowly smoothly go back to zero in the players should stop watching

Test this out

Here we go

Very slowly sending it back

Turning the player

In a direction and then slowly sliding so watch

Derry girls

Very sadly right

Set alarm for carvery with makers Valley a little bit bigger hear something like five so that he doesn't

Take so long to stop sliding

There we go

OK get so he's getting it push just a little bit

Alright

Looks a little weird because we're not actually moving the player in the Y Direction just yeah

So let's set the large power something like 15 so now that large recovery values

Tyre

Push the player a little bit harder

There we go that looks great

Remember when we exit play mode we're gonna lose these values here so what's memoriser

Large recovery is 5 in large power is 15

Ireland

Plugged in

Light recovery

5 large power of 15

And now all we need to worry about now guys

Is lodging the player in the Y Direction

By a certain value in this case it's going to be the launch Power Wye Valley

Now fortunately going in the Y Direction is a lot simpler here so what we going to do is just go back to the original Star

In the new player script

And I'm going to do

Is I'm just going to set

Velocity

Why I'm going to said that to the launch Power

That way

So what I was going to push the player up into the Year right there's nothing really

Regarding the velocity in the y-direction there's nothing related to the target side

So what does always going to knock the player into the air

So that's why this is so simple the last few that y = large power

Don't worry

And that should do it

What's tested out

Alright here we go

So curly the Y value is set to 0 here

I said this to you 5

2 happens

Ok good

Send it to you 15

Pre big bang

It's another bad intense maybe 10

Ok

Alright looks great so I think that that is fine for now there is an episode

Tutorial which is going to be

Just cleaning up a lot of a game feel just cleaning up the player movement and how things feel

But in terms of functionality

I mean this is great

Again make sure you memorise the value so it's 5

15 and 10

How much can a plug goes in 515 in

10 mm

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.