Operation Null Mind 0.4.1
A 2D roguelike top down shooter game made with SDL2
 
Loading...
Searching...
No Matches
player_movement.c File Reference

Handles player character movement. More...

#include <player.h>
#include <time_system.h>
#include <app.h>
#include <input.h>
#include <colliders.h>

Functions

int Player_Look (Vec2 direction)
 [Utility] Sets the player's movement direction
 
int Player_Move ()
 [PostUpdate] Moves the player according to current direction and speed
 
void Player_UpdateHitbox ()
 [Utility] Updates the player's hitbox position based on current position
 

Detailed Description

Handles player character movement.

Contains functions for moving the player character, handling acceleration, and managing movement states.

Author
Mango
Date
2025-03-03

Function Documentation

◆ Player_Look()

int Player_Look ( Vec2  direction)

[Utility] Sets the player's movement direction

Makes player look in specified direction.

Updates the player's direction vector and sets appropriate movement speed. Ignores input if the direction is locked (e.g., during a dash).

Parameters
directionThe direction to move the player in
Returns
int Status code (0 for success)

◆ Player_Move()

int Player_Move ( )

[PostUpdate] Moves the player according to current direction and speed

Moves the player.

Applies the player's direction and speed to position, handles collision checking, and updates movement state flags.

Returns
int Status code (0 for success)

◆ Player_UpdateHitbox()

void Player_UpdateHitbox ( )

[Utility] Updates the player's hitbox position based on current position

Updates player hitbox.

Recalculates the position of the player's collision hitbox to match their current world position, with appropriate offsets.