Join Jesse Freeman for an in-depth discussion in this video Clean up the alien AI, part of Unity 5: 2D Building an Adventure Game.
- [Instructor] Now all we have to do…is clean up the rest of our alien AI.…The first thing is that we should make the player explode…whenever they touch an alien.…To do this,…let's go into our Jetroid Prefabs folder…and select the alien.…We're going to change the tag to Deadly.…Unfortunately, right now,…our Player Explodes Script only works on collision…when it's set to Target.…Let's go ahead and fix that…by selecting the player,…scrolling down to our Explode Script…and opening it up in MonoDevelop.…
Let's go ahead and copy the OnTriggerEnter2D code…and paste it below.…We're going to re-name this to OnCollisionEnter2D…in order to detect collisions…from colliders that aren't set to triggers.…The last thing we need to do…is change the type that gets entered into this method…and we're going to set this…to a Collision2D.…Now let's hit Save…and test out that this works.…
And now, if the player collides with an alien,…you'll see that they'll get destroyed…and we're left with a debris.…While this works really well as it is,…
- Optimizing sprites and draw cells
- Cutting up sprite sheets
- Building animations
- Changing animations
- Creating a player
- Moving the player
- Building a level with a simple map
- Creating interactive objects
- Creating alien enemies
- Switching between scenes
Skill Level Intermediate
Build a Real-Time Strategy Game with Unity 5with Dan Violet Sagmiller3h 47m Intermediate
Careers in the Game Industrywith Christian Bradley1h 19m Beginner
1. Working with Sprites
2. Working with Animations
3. Creating a Player
4. Moving the Player
5. Building a Level
6. Interactive Objects
7. Alien and AI
8. Managing Scenes
Next steps1m 9s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.