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
Before we wrap up the course there is one final bug to address and that is that
Enemies can get stuck in the wall
As you say
Right here
And this happens under a verb
Specific Circumstance which I will describe
Now
So let's go to our handy paint and let's
Draw a line that rep
Against the wall and if you recall
The way that we
Spon End
Is that we take the player position which is let's a right
Who's the player
And we basically shark
A vector
Along some Direction
To see if there is a collision
Edit there isn't a collision
Respond
Enemy
What happens if h
Raycast
Ends one pixel before the wall likes
And doesn't register a collision we say oh
Well then that means that there is no collision in so what we're going to do
An enemy
So we spawn the end
Play here
However
The enemy is now on top of the wall and
Subtitled by online-courses.club We compress knowledge for you!
Remember the enemy has a collision shape which is like a circle
Are the enemy ends up with a circle Collider
That is halfway inside of a wall
So the fix for this is really simple instead of checking the exact distance along which we
How to spawn the end
We're actually going to add
An additional 20 years so pixel check
Like so
So that means that if it's whole range if this whole
Line
Does not contain a collision
Then we'll go ahead and spawn the enemy
The tip
The Orange
Desired
Sponge
So essentially just adding an extra 20 years ago pics
Checking to the
The array
So that we can be guaranteed that there will be at least 20 pixels of distance between
Responding the enemy
Between the
So let's go ahead and open up our enemy manager
And implement exactly that fix so go ahead and open up the screw
And basically and hear what we've got going on is we are setting the enemy spawn position
To the player global position plus that random Direction
Choosing
Up here
X the spawn radius
And like I showed in the drawing we basically want to
Something
20 additional pixels
To the Ray
Checking
And so what we're going to do for that
Is were going to create a new variable called additional
And we're just going to random Direction
Times 2
And then in this line we were constructing the physics re query parameter
We just simply going to add that additional check offset to the second
So it's going to be spawn position Plus
Additional
Check
Off
So what does essentially going to do is that's going to create a rave and the player position
To the spawn position that we want to have for the enemy
But Plus
An additional 20 pixel
In the same direction
And as long as that raycast does not return a collision result
Then we can spawn em
So you can run the game to test it's going to be very difficult to test
But
If you play the game a little bit more you should notice that it stops
Happening
And enemies are still spawning like normal
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.