![]() |
R-Type
2
Doom but in better
|
Go to the source code of this file.
Functions | |
void | move_player (Registry &r, std::size_t id, float x, float y) |
Moves a player to a specified position. | |
void | movement_system (Registry &r, ComponentContainer< Position > &positions, ComponentContainer< Velocity > &velocities) |
Handles the movement of entities based on their velocity. | |
void move_player | ( | Registry & | r, |
std::size_t | id, | ||
float | x, | ||
float | y ) |
Moves a player to a specified position.
This function updates the position of the player identified by the given id
in the provided Registry
. The player's new position is set using the provided x
and y
coordinates.
r | Reference to the Registry instance where the player's components are stored. |
id | The unique identifier of the player to move. |
x | The new x-coordinate of the player's position. |
y | The new y-coordinate of the player's position. |
Definition at line 5 of file MovementSystem.cpp.
void movement_system | ( | Registry & | r, |
ComponentContainer< Position > & | positions, | ||
ComponentContainer< Velocity > & | velocities ) |
Handles the movement of entities based on their velocity.
This function updates the position of entities by applying their Velocity
component. It calculates the new position based on the entity's current velocity and updates the Position
component accordingly. This system is typically called every frame to ensure entities move smoothly in the game world.
r | The Registry that contains all game entities and their components. |
positions | The container of the component Position . |
velocities | The container of the component Velocity . |
Definition at line 16 of file MovementSystem.cpp.