R-Type  2
Doom but in better
Loading...
Searching...
No Matches
MovementSystem.cpp File Reference
#include "MovementSystem.hpp"
#include "IndexedZipper.hpp"
#include "Time.hpp"
Include dependency graph for MovementSystem.cpp:

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.
 

Function Documentation

◆ move_player()

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.

Parameters
rReference to the Registry instance where the player's components are stored.
idThe unique identifier of the player to move.
xThe new x-coordinate of the player's position.
yThe new y-coordinate of the player's position.

Definition at line 5 of file MovementSystem.cpp.

◆ movement_system()

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.

Parameters
rThe Registry that contains all game entities and their components.
positionsThe container of the component Position.
velocitiesThe container of the component Velocity.

Definition at line 16 of file MovementSystem.cpp.