Unity Platformer Tutorial - Part 4 - Enemy Movement

Pubblicato il: 12 luglio 2015
sul canale di: Devin Curry
60,356
546

In part 4 of this Unity3D tutorial we add Enemy AI. The enemy will walk from edge to edge of a platform as long as it's alive. This sort of enemy movement can be seen in many 2D Platformer games like Mario.

There is a dependency on the toVector2 function we wrote here:    • Unity Extension Method Tutorial  

Visit my website to see the code: http://www.devination.com/2015/07/uni...
Twitter:   / devination3d  
Google+ Community: https://plus.google.com/communities/1...
Facebook:   / unity3dtutorialsbydevin  

Time Breakdown:

0:30 - Updating API from Unity 4.6 to Unity 5
1:45 - Setting up the enemy sprites
2:38 - Locking Layers to avoid accidentally selecting the Canvas
3:40 - Setting up the Enemy walk anim
4:38 - Begin Enemy script
6:56 - Explanation of why we need myWidth for Linecast
9:10 - Setting up isGrounded Linecast check
12:35 - Use isGrounded check to flip the enemy if he gets to an edge
15:52 - Changing move direction to be in local space to the enemy
16:45 - Adding an isBlocked check for hitting walls
17:21 - Using ExtensionMethod .toVector2() to add a Vector2 and a Vector3:    • Unity Extension Method Tutorial  
20:20 - Using myHeight to Linecast from middle left of enemy instead of bottom left corner
22:24 - Demonstration of enemy movement fully working


In questa pagina del sito puoi guardare il video online Unity Platformer Tutorial - Part 4 - Enemy Movement della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Devin Curry 12 luglio 2015, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 60,356 volte e gli è piaciuto 546 spettatori. Buona visione!