Skip to content

Player Controller

Theo Ruefli edited this page Jun 16, 2026 · 29 revisions

System Summary

The player control is what enables the player to move and interact with the level they've built in the testing mode.

The player controller is what handles player input in the testing mode as well as how the player interacts with the environment existing in the level, it is what handles the logic when certain tile types are hit and all of the different values that can be modified in the editor pertaining to the player (speed, jump height, etc). There are also four different movement presets available for the player, allowing users to easily set their movement type.


Connected Systems

Connecting Systems:


Related Controls

List of related controls.

Key(s):

  • Space: Jump, if there's enough coyote time left then can jump in midair
  • A or ←: Move Left
  • D or →: Move Right
  • S or ↓: Drop down through One-Way tiles or detach from sticky tile above

Bugs

  • Player moves up slopes slower than normal movement

Feature List / Breakdown of Features

Player Controlling:

  • Player can jump and move around the environment
  • Friction and air control alter how quickly the player can accelerate or decelerate on ice tiles or in midair

Player Interaction:

  • Player touches different tile types to interact with them.
  • Depending on the type, the player encounters a different effect.
  • All tiles except death tiles can only be interacted with by landing on top of them.
  • When moving out of bounds, the player is killed.

Modifiable Values:

  • Different stats (movement speed, fall speed, jump height, FPS, coyote time, and air control) are all present.
  • Modifying the values changes how the player moves around in the level.
  • Four different presets for easily setting a movement preset for the player.

Important Variables

  • groundSpeed : float = The speed of the player when on the ground.

  • jumpheight : float = The amount of tiles the player can jump.

  • airControl : float = The amount of control the player has midair.

  • fallSpeed : float = How quickly the player falls in air.

  • coyoteTime : float = How long after stepping off a platform the player can still jump.

  • playerMovementPreset : PlayerMovementPreset = The currently selected and applied player movement preset.

Important Functions

Name of the most important functions, their parameters, and what they do.

  • func run() -> void: Handles left and right movement for the player, including deceleration when there is no input. The airControl variable also effects the movement speed of the player in air within this function.

  • func jump() -> void: Handles the jumping of the player based on the jumpHeight.

  • func take_damage(amount: int) -> void: Deals amount damage to the player based on their health, and if their health is <= 0, executes die().

  • func detect_tiles() -> void: Detect the object the player is touching, including enemies or tiles, and apply the correct effects based on that collision.


Future Work / Risks

List and description of upcoming work/risks.

Future Work:

  1. Using FPS to make animations
  2. Changing hitbox to a rectangle.

Risks:

  • Due to how collision detection currently works, the hitbox for the player is still a circle and not a rectangle, currently I am not aware of a fix for collision detection so it doesn't mess up when dealing with a flat hitbox.

Miscellaneous Notes

A place for miscellaneous notes pertaining to this system.

  • None

Clone this wiki locally