A quick and dirty Unity project that acts as a jumping off point for anyone looking to make a simple 2D platformer.
- Basic player state management (Idle, Walking, Jumping, Falling, and WallClinging)
- Variable jump
- The longer the player holds down the jump button, the higher the jump is
- Wall clinging/wall jumping
- Wall clinging currently slows the rate of gravity by a little bit more than half, but this can also be easily changed by modifying this line in
PlayerController.cs:Unity-Platformer-Template/Assets/Scripts/PlayerController.cs
Lines 111 to 113 in 30aab35
- Wall clinging currently slows the rate of gravity by a little bit more than half, but this can also be easily changed by modifying this line in
- Double jump (easily removable by altering
_maxJumpsfrom 2 to 1): - Fall through platforms (down button + jump button)
- Allows the player to drop through platforms using
Physics2D.IgnoreLayerCollision(can be found inControllerUtils.cs)
- Allows the player to drop through platforms using
- Head bump
- Kills a jump if the player bumps their head on the ceiling above them
Either clone, download, or fork this repo to use this as a starting point.
Or just grab the PlayerController.cs and ControllerUtils.cs scripts and bring them into any existing project (note: you'll need to modify PlayerController to use whatever input system you currently have as well as setup any physics layers for platforming).
