Unity Platformer Tutorial - Part 4 - Enemy Movement

Veröffentlicht am: 12 Juli 2015
auf dem Kanal: 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


Auf dieser Seite können Sie das Online-Video Unity Platformer Tutorial - Part 4 - Enemy Movement mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Devin Curry 12 Juli 2015 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 60,356 Mal angesehen und es wurde von 546 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!