Join Jesse Freeman for an in-depth discussion in this video Move the player left and right, part of Unity 5: 2D Building an Adventure Game.
- [Narrator] Now that we have our players' collision…in place let's go ahead and start adding the code…that will make our player move left and right.…Let's go into Jetroid's root folder…and create a new folder inside of it…and we'll call this Scripts.…Then inside of the scripts folder…let's right click again…and create a new C# Script.…We're going to call this Player.…Once the script is created let's double click…on it in order to open MonoDevelop.…
Here you'll see our new player class.…It's automatically extending MonoBehavior…so that we can use it inside of our game…and it has two methods, our start and update method.…Before we start adding the code to make the player move…we're going to need to set up a few fields…that will store the values of the speed…and other properties we need in order to make this work.…Above the start method let's make some space…and create our first public field.…
We're going to set this to a type of float…and we're going to call this speed.…Let's set the value to 150F.…Since we're using a float, we use F at the end…
- 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.