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
Search do a little bit of code clean up really quick clean
Yes
Ian
Just remove that debug we don't need anymore we also don't need
Is debug here either so it's a bit out
And what we're going to do is really going to talk about what's cold conditions
Conditions are basically how are you
Test whether something is true or false
Mmm do something based on
If it's true or false
Kind of makes very little sense when I say it like that but what if I write something like this
If
I'm touching
The right of the screen
Stop moving
NN
All of this if I'm touching the left of the screen
Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1
Start moving
What is this mean what is your boundaries so if I go to my
Unity editor
If
I'm over here
I want to stop moving
So that I can't go
Past
The left side
I meant if I'm touching the right side of the screen
I can't move to the right
Well what are those actual values
Mohamedou left here
You know this that
I'm at -8.35
I'm at the right over here
I'm a positive 8.35
Factors values can be equal
So
Can we write this out on a script
Basically
Not actually putting fantasies
The ratio of the screen is 8.35
Is the left side of screen is -8.35
The way we write this is
If princesses
Transform
That position
X is
Greater than 8.35
Then we want to set our transformed value to be 8.35 so we're going to do is Transformed
Position
And you would assume it that x = 8.35
Well you can actually do this in c-sharp you can definitely do this kind of
Code in Javascript but the X value of position
Is what card a read-only value you can actually said it you can only get it
But you can set the actual vector
So new vector3
8.35 fnn transform that position
Why
And explain this is just a second guys
Transform that position
Darkzy
Ok
So what this means is
Is my positional value of x is greater than 8.35 AKA
Find past the right side of the screen
Immediately set my transformed up position to a new vector of
8.35
And the current
My position so wherever I am on the y-axis just maintain that
And the same is true with the z-axis as well
Search test this outlet test out the right boundary
What's it play here
And don't worry sometimes you gonna get warning
Messages that's ok
Seizure
Works great
I can't move past the right side of the screen
Mum and I get 8.35 notes
Selling it 8.35
And you can actually see it but it's constantly over and over and over and over and over and over again setting at 8
335
Again because the inside of the update loop
That can only do it once it's going to do it over and over and over again you just can't see it with your eye
I thought to do the left side as well
Are we going to do is
Well
When we just copy this paste it down here
Now you want to do it flip it
So if transformed opposition that x is smaller than
Negative
8.35
Immediately set it to -8.35 f
Resetting the X value
The Wi-Fi is the same disease the same as well
Unity
Can you play
Ok
What's great
Can't move to the right
Pass the screen
10 or the left
That's exactly what we were
Let's go ahead and do this for the why buy you as well
What let's move up and see what the why
Top value is here
Looks like it's 4.47
Ok
Probably the same for the bottom
Except Megan
Just about to -4.47
Let's just make it a clean 4.45
So
Let's just copy both of these
Pasting down here
You noticed that you're going to start doing this more and more and more
When you create a new game just copying and pasting code
So what was it it was 4 point
64.5 nice and clean
And then negative
4.45
4.5 m
If I'm touching the bottom of the screen and top of the screen
Start moving in again guys these comments are only here for us
The night for the code I don't need these for the code it just help me know
What is section
Is doing
So let's just focus on this really quick don't worry about this in fact I'm gonna just delete it and so you don't panic
Because I know the one I was learning how to code I would pay it cos it's so much on screen
But if I'm touching the top of the screen which is 4.5 Stop Moving so if transformed at position
Why
Get greater than
4.5
Transform deposition equal and secure getting there we need to make sure we use a princess is there there we go
Then my trains from that position is going to equal the new vector now remember this is the X value
This is the Y value in this is the Z value
So we're setting the transformed position
To a y value
For this
Condition that tested with touching the top of the screen
So you just want this to be the same transformed at position
Directs
So you're not really changing anything there were just saying set the position of the X value to its
So nothing's changing there
We do want to change the Y value which would be 4.5
Save that
Because I know this is going to work we can kill two birds with one stone
Set this to negative
4.5
If I'm touching the bottom of the screen which is
Smaller than -4.5
Senator -4.5
Flipping the signs
For about the condition and also the plug how are you
No display of the red squiggly that's just because we need an F&F here
It save
Jumping unity
Hit play
And we should have everything working properly
Looks grey so I can't get out of this box
And that because we are using the if statement
Which is a condition
Alright works great
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.