Keyboard controls
PlatformerGame uses intuitive keyboard controls for all player actions. The game is built with Unity’s Input System for responsive and precise control.Movement
WASD keys
Use W, A, S, D keys for movement:
- A: Move left
- D: Move right
- W: Jump (alternative)
Arrow keys
Use arrow keys for movement:
- Left Arrow: Move left
- Right Arrow: Move right
- Up Arrow: Jump (alternative)
Actions
| Key | Action | Description |
|---|---|---|
| Space | Jump | Primary jump button - press and hold for higher jumps |
| Enter | Start Game | Begin playing from the Title screen |
| Esc | Quit | Exit the game |
Both WASD and arrow keys work simultaneously - use whichever feels more comfortable for your playstyle.
Gameplay mechanics
Jumping system
The game features a sophisticated jumping system implemented inPlayerJump.cs:
- Variable height jumping: Hold the jump button longer for higher jumps. The jump height scales based on how long you press the button (up to
PressTimeToMaxJumpduration) - Double jump: After your first jump, you can perform a second jump in mid-air for extra height and distance
- Wall sliding: When touching a wall in the air, your fall speed is reduced to
WallSlideSpeed, allowing for wall jump maneuvers
Movement controls
Player movement is handled by thePlayerInput.cs script with these characteristics:
- Speed: Default horizontal movement speed is 5.0 units per second
- Direction: The character sprite automatically flips to face the direction you’re moving
- Animation: Walk animation speed adjusts based on your movement intensity
Collecting coins
Coins are collected automatically when your player touches them:- Walk or jump into a coin to collect it
- Each coin adds to your total score
- Collected coins trigger the
Coin.OnCoinCollectedevent and are removed from the level - Your final score is displayed at the end of the game
Power-ups
Power-ups provide temporary ability boosts:- Collection: Touch a power-up item to activate its effect
- Jump boost: Increases your jump height for enhanced platforming
- Effect application: Power-ups use Unity ScriptableObjects, allowing for easy customization of effects
Tips for success
Master the variable jump
Practice short taps for small hops and long presses for maximum height. This is crucial for landing precisely on narrow platforms.
Use double jump strategically
Save your double jump for when you really need it. You only get one per grounded jump, so use it to recover from mistakes or reach high areas.
Utilize wall sliding
When falling near a wall, press into it to activate wall slide. This slows your descent and lets you reposition for a wall jump.
Input system configuration
The game uses Unity’s Input System package with configuration files located inAssets/InputSystem/. The input handling is split across multiple components:
- PlayerInput.cs: Handles horizontal movement via the
OnMovecallback - PlayerJump.cs: Responds to jump button press (
OnJumpStarted) and release (OnJumpFinished) events - MainMenu.cs: Handles the Enter key for starting the game from the Title screen
- QuitGame.cs: Handles the Esc key for exiting the application