Join Jesse Freeman for an in-depth discussion in this video Making the player run, part of Advanced Unity 2D: Platformer Player Movement.
- Now you may have noticed that our player…is a little bit slow when he walks.…Of course, we can update the speed…but a better solution is to actually add a new key…that'll modify the speed at which he walks…and allow him to run.…In order to do this, we're gonna need…to open up our walk script.…In here, we're gonna add a new public property…that'll represent the multiplier that will use…to increase the speed value…when the run key is being pressed.…Create a public float and call this runMultiplier.…
And we'll set this value to 2.…This means when we're running, we'll be actually multiplying…the speed by 2 and make him look like he's going faster.…Next, we're gonna need to keep track…if the run key is being pressed.…Let's copy the left key and change this to run…and set the inputState to 2, we'll add a new button later.…Then, before we actually calculate the velocity X…let's modify the temp speed.…
In this case, we're gonna want to make sure…that run is actually being pressed…and that the runMultiplier is greater than 0.…
Author
Updated
7/5/2016Released
5/14/2015- Building an input manager for keyboard and controllers
- Setting up the player
- Building reusable, self contained, and modular behaviors scripts
- Adding behaviors: walking, running, and jumping
- Managing animation states and player collisions
- Adding a ducking animation
- Detecting wall collisions
- Sticking to, sliding down, and jumping off walls
- Picking up items
- Firing projectiles
Skill Level Advanced
Duration
Views
Related Courses
-
Advanced Unity: 3D Game Programming
with Michael House3h 45m Advanced -
Creating Mobile Games with Unity
with Kelley Hecker1h 12m Intermediate -
Unity 4: 2D Essential Training
with Jesse Freeman4h 3m Intermediate
-
Introduction
-
Welcome44s
-
-
1. Working with Input
-
Input introduction5m 52s
-
Building an input manager5m 55s
-
Abstracting axis input5m 2s
-
-
2. Walking and Running
-
Building a test level5m 59s
-
Saving direction state5m 51s
-
Adding walking to the player2m 50s
-
Making the player run4m 34s
-
3. Player Animations
-
4. Managing Player Collisions
-
5. Jumping
-
Making the player jump3m 17s
-
Limiting jump2m 49s
-
Adding the jump animation2m 42s
-
Adding double jump4m 19s
-
Adding long jump6m 55s
-
-
6. Ducking
-
Adding ducking to the player5m 12s
-
Adding the ducking animation3m 34s
-
-
7. Wall Collision
-
8. Sliding Down Walls
-
Sticking to walls5m 55s
-
Sliding down walls3m 52s
-
Speeding up wall slide2m 45s
-
-
9. Jumping Off Walls
-
Cleaning up the wall jump3m 10s
-
10. Items
-
Picking up items3m 34s
-
Equipping items4m 58s
-
-
11. Firing Projectiles
-
Creating a fireball3m 29s
-
Destroying the fireball1m 40s
-
-
Conclusion
-
Next steps41s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Making the player run