-
Notifications
You must be signed in to change notification settings - Fork 0
Player Controller
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.
Connecting Systems:
List of related controls.
Key(s):
- Space or W or ↑: 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
- Player moves up slopes slower than normal movement
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 affect the player from all sides.
- 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.
-
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. -
maxHealth : int= The maximum amount of health the player can have.
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. -
func detect_enemies(body: Node2D) -> void: If an enemy is touching the player take damage. -
func detect_projectiles(area: Area2D) -> void: If a projectile is touching the player take damage. -
func bounce() -> void: Exerts a vertical force on the player. -
func apply_preset(preset: PlayerMovementPreset) -> void: Sets all of the player's values to those of the selected preset. -
func check_out_of_bounds() -> bool: Checks if the player is outside of the bounds of the level.
List and description of upcoming work/risks.
Future Work:
- Using FPS to make animations
- 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.
A place for miscellaneous notes pertaining to this system.
- None
Resources
Known Issues
Future Work
Globals
Managers
- Main Menu Manager
- Master Manager
- Camera Manager
- Hotkey Manager
- Import Export Manager
- Audio Manager
- Animation Manager
- PopUp Manager
UI
Managers
- Editor Manager
- Tile Manager
- Entity Manager
- Icon Manager
- Preview Manager
- Tool Manager
- Asset Manager
- Custom Cursor Manager
Tiles & Entities
- Grid Lines
- Preview Line
- Tiles & Entities
- Enemies
- Patrolling Enemy
- Flying Enemy
- Shooting Enemy
- Stationary Enemy
- Moving Platform
- Property Editing
Asset Swapping
UI
Managers
Player