From the course: Unity 5: 2D Building an Adventure Game
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Enable flying - Unity 2D Tutorial
From the course: Unity 5: 2D Building an Adventure Game
Enable flying
- [Instructor] Now it's time for us to wire up the jet pack for our player. Select a player from the hierarchy, scroll down to the player script, and double click on the script name. This will bring us back into MonoDevelop and into the script we were just editing. Then scroll up to the top, and we're going to create a few new public fields. We'll start by creating a new float and we're going to call this jetSpeed. And we're going to set this to 200f. Next, we'll create a new public field that's a bouillon, and we're going to call this standing. By adding a semi colon at the end, the value will automatically be set to false when the code is compiled. Finally, let's create a new public float and we're going to call this standingThreshold. And we're going to set this equal to 4f. We'll use this threshold in order to determine whether the player has hit the ground and it's okay to consider him standing. Now let's scroll down to the update method and right below where we calculate the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.