-
Notifications
You must be signed in to change notification settings - Fork 0
Player Controller
The player controller allows the user to move the player while testing a level. It handles player physics and interactions with different tile types using ray casts, and it applies any custom properties set by the user in the editor state. The player properties are organized into several presets that can be chosen to aid the user's direction.
Connecting Systems:
List of related controls.
Key(s):
- Space, W or ↑: Jump, either from the ground or while coyote time is still left.
- A or ←: Move Left
- D or →: Move Right
- S or ↓: Drop through One-Way tiles.
- Slopes may cause odd behaviors, such as the player moving upwards more slowly than downwards.
Player Controlling:
- The player is always able to jump and move. If toggled, the player can also wall jump, double jump, and slide on walls that aren't composed of ice tiles.
- Friction and air control alter how quickly the player can accelerate or decelerate on ice tiles or in midair.
Player Interaction:
- Using ray casts, the player will interact differently with each tile type, depending on what side the player makes contact from.
- The player cannot exit the boundary of the level due to the border. They also cannot wall jump on the border.
Modifiable Values:
- All numeric stats and toggles (wall jump, double jump movement speed, fall speed, jump height, FPS, coyote time, and air control) can be modified. This affects how the player controls and allows for many combinations of properties.
- Four presets exist to auto-set the player's stats according to an archetype.
-
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. -
doubleJump: bool= Determines if the player can double jump. -
wallJump: bool= Determines if the player can jump and slide on walls.
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
Risks:
- None currently
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