Join Jesse Freeman for an in-depth discussion in this video Making the player jump, part of Unity 5 2D Essential Training (2015).
- View Offline
- Exercise Files
- Now we're ready to make the player jump.…Let's go into our Scripts folder…and create a new script called "Jump."…When it comes to adding behaviors…like "jump" or "moving forward,"…I like to break them out into their own little scripts.…This way, everything is reusable…and also it only has to focus on doing one simple task,…in this case, making our player jump.…We'll connect the player jump to the input state…so that the Jump class has some sort of knowledge…of what the player is doing without having…to know really much about the player itself.…
Let's open this up MonoDevelop.…At the top of our class, let's add a few properties.…First, we're gonna need a public float…that represents the jump speed.…Here, we'll set this to 240.…Next, we're gonna need a reference…to the Rigidbody2D and the input state on the game object.…Let's create a private property for Rigidbody2D,…called "body2d,"…and we'll also create a private property…called "inputState" for the input state.…
Next, let's make a new Awake method,…and in it, we'll set the body2d…
Super Zombie Runner riffs off the popular endless runner genre: a one-button casual game that's not only fun to play but exciting to build. The focus of the work is a reusable code base that you can extend and make your own, while learning the basics of object pooling, supporting multiple screen resolutions, tracking scoring, and multi-platform publishing. Along the way, Jesse covers key Unity features, such as working with sprites, creating animations, and leveraging the UI components.
- Working with sprites and animation
- Creating the player
- Spawning GameObjects
- Adding obstacles and collisions
- Building the game objects and logic
- Managing game state
- Creating pixel-perfect cameras
- Designing for multiple screen resolutions
- Adding scores
- Optimizing performance
- Publishing to desktop, web, and mobile platforms
Skill Level Intermediate
1. Working with Sprites
2. Creating Repeating Textures
3. Creating Obstacles
4. Object Pooling
5. Creating the Player
6. Setting Up the Game
7. Adding UI
8. Creating More Obstacles
- 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.