Join Jesse Freeman for an in-depth discussion in this video Turnaround at walls, part of Unity 5: 2D Building an Adventure Game.
- [Narrator] Right now, our alien only knows…how to move forward.…It has no concept of whether it hits a wall or not.…In order to fix that, we're going to create a new script.…We're going to call this script LookForward.…Let's open this up in MonoDevelop.…We're going to use this script to keep track…of whether the alien collides with an object…that's in front of it.…First off, we're going to need to store two transforms:…the beginning of where we're looking…and the end of where we're looking.…
Let's create a public field called Transform.…We're going to call the variables…sightStart and sightEnd.…Next, let's create a private field…that's typed to a boolean.…We're going to call this collision,…so we can keep track of…whether a collision has occurred or not.…By default, we'll set this value to false.…In the Update method,…we're going to ask the Physics2D class…to cast a line between the start and end position…and check to see if it collides…with a specific layer by name.…
We'll set the collision value to equal,…Physics2D,…
- 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
Careers in the Game Industrywith Christian Bradley1h 19m Beginner
Build a Real-Time Strategy Game with Unity 5with Dan Violet Sagmiller3h 47m Intermediate
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.