In this video, Jesse Freeman teaches you how to move your new obstacle prefab. You'll learn how to place the prefab, create a script on it and how to manipulate the position of the GameObject's transform via code inside of Unity. Learning how work with GameObjects in Unity 5 is an important skills for building a 2D game.
- [Voiceover] So now we're ready…to actually make our object move.…A few things we'll have to set up before that…is let's make sure that our obstacle has a box collider.…Here we'll filter out for a box collider 2D.…By adding the box collider,…we'll allow this object to interact…with other objects with colliders on them,…like the player which we'll add later on.…Now let's create a script…to make this move across the screen.…Inside of our script folder,…let's create a new C# script,…and we're gonna call this instant velocity.…
Then let's open this in MonoDevelop.…We'll start out by setting up a property…to store the velocity we want this object to have.…We'll make this a vector two,…and call it velocity.…And let's instantiate it…as a vector two that's been zeroed out.…Next, we'll need a reference to the rigid body itself.…Let's create a property to store the rigid body.…We'll type it to rigid body 2D and call it body 2D.…Next, we'll need to get a reference…to the actual rigid body.…
We'll do this in an awake method.…
Start watching to learn how to convert artwork into sprites, create repeating background textures with Unity's TexturePacker, and build reusable game objects such as players, obstacles, and enemies. Jesse also covers the basics of object pooling, working with custom UI components, and multiplatform publishing.
- Importing artwork
- Editing sprites
- Creating repeating background textures
- Building reusable obstacles
- Recycling game objects
- Building an object pool
- Creating the player
- Starting and ending the game
- Displaying and saving the score
- Adding menus and text
- Publishing a Unity game in different formats
Skill Level Beginner
1. Working with Sprites
2. Creating Repeating Textures
3. Creating Obstacles
4. Object Pooling
5. Creating the Player
6. Setting Up the Game
7. Polishing the Game
8. Creating More Obstacles
Publish to different formats5m 42s
- 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.