R-Type  2
Doom but in better
Loading...
Searching...
No Matches
SpawnSystem.cpp File Reference
#include "SpawnSystem.hpp"
#include <iostream>
#include "Random.hpp"
#include "Registry.hpp"
#include "Time.hpp"
Include dependency graph for SpawnSystem.cpp:

Go to the source code of this file.

Functions

void spawn_monster_system (Registry &r)
 Spawns a monster periodically based on the spawn timer.
 
void spawn_obstacle_system (Registry &r)
 Spawns obstacles periodically based on the spawn timer.
 
void spawn_player (Registry &r, const float pos_x, const float pos_y, const uint32_t client_id, const std::string &username)
 Spawns a player with the specified username at the given position.
 
void spawn_monster (Registry &r, const float pos_x, const float pos_y)
 Spawns a monster at the specified position.
 
void spawn_obstacle (Registry &r, const float pos_x, const float pos_y)
 Spawns an obstacle at the specified position.
 
void spawn_missile (Registry &r, const float pos_x, const float pos_y, const type_enum owner)
 Spawns a missile at the specified position.
 
void spawn_powerup (Registry &r, const float pos_x, const float pos_y, const loot_enum type)
 Spawns a power-up at the specified position.
 

Variables

float spawn_timer = DEFAULT_TIMER
 
float spawn_obstacle_timer = DEFAULT_TIMER * 3
 

Function Documentation

◆ spawn_missile()

void spawn_missile ( Registry & r,
const float pos_x,
const float pos_y,
const type_enum owner )

Spawns a missile at the specified position.

This function spawns a missile entity in the game at the given position (pos_x, pos_y) and assigns it to the appropriate owner (player or monster).

Parameters
rThe Registry that contains all game entities and their components.
pos_xThe X-coordinate for the missile's initial position.
pos_yThe Y-coordinate for the missile's initial position.
ownerThe type of the entity that owns the missile (player or monster).

Definition at line 79 of file SpawnSystem.cpp.

◆ spawn_monster()

void spawn_monster ( Registry & r,
const float pos_x,
const float pos_y )

Spawns a monster at the specified position.

This function spawns a monster entity in the game at the given position (pos_x, pos_y). The monster is initialized with appropriate components, such as position and type.

Parameters
rThe Registry that contains all game entities and their components.
pos_xThe X-coordinate for the monster's initial position.
pos_yThe Y-coordinate for the monster's initial position.

Definition at line 50 of file SpawnSystem.cpp.

◆ spawn_monster_system()

void spawn_monster_system ( Registry & r)

Spawns a monster periodically based on the spawn timer.

This system handles the spawning of monsters at regular intervals. The spawn_timer is used to determine the frequency at which monsters are spawned.

Parameters
rThe Registry that contains all game entities and their components.

Definition at line 11 of file SpawnSystem.cpp.

◆ spawn_obstacle()

void spawn_obstacle ( Registry & r,
const float pos_x,
const float pos_y )

Spawns an obstacle at the specified position.

This function spawns an obstacle entity in the game at the given position (pos_x, pos_y). The obstacle is initialized with appropriate components, such as position and type.

Parameters
rThe Registry that contains all game entities and their components.
pos_xThe X-coordinate for the obstacle's initial position.
pos_yThe Y-coordinate for the obstacle's initial position.

Definition at line 66 of file SpawnSystem.cpp.

◆ spawn_obstacle_system()

void spawn_obstacle_system ( Registry & r)

Spawns obstacles periodically based on the spawn timer.

This system handles the spawning of obstacles at regular intervals. The spawn_obstacle_timer is used to determine the frequency at which obstacles are spawned.

Parameters
rThe Registry that contains all game entities and their components.

Definition at line 23 of file SpawnSystem.cpp.

◆ spawn_player()

void spawn_player ( Registry & r,
const float pos_x,
const float pos_y,
const uint32_t client_id,
const std::string & username )

Spawns a player with the specified username at the given position.

This function spawns a player entity in the game with the specified username. The player is initialized at the given position (pos_x, pos_y) and other components related to the player.

Parameters
rThe Registry that contains all game entities and their components.
pos_xThe X-coordinate for the player's initial position.
pos_yThe Y-coordinate for the player's initial position.
client_itThe client id of the player.
usernameThe username of the player.

Definition at line 34 of file SpawnSystem.cpp.

◆ spawn_powerup()

void spawn_powerup ( Registry & r,
const float pos_x,
const float pos_y,
const loot_enum loot )

Spawns a power-up at the specified position.

This function spawns a power-up entity in the game at the given position (pos_x, pos_y). The type of power-up is determined by the loot_enum.

Parameters
rThe Registry that contains all game entities and their components.
pos_xThe X-coordinate for the power-up's initial position.
pos_yThe Y-coordinate for the power-up's initial position.
lootThe type of loot (power-up or health) to be spawned.

Definition at line 100 of file SpawnSystem.cpp.

Variable Documentation

◆ spawn_obstacle_timer

float spawn_obstacle_timer = DEFAULT_TIMER * 3

Definition at line 9 of file SpawnSystem.cpp.

◆ spawn_timer

float spawn_timer = DEFAULT_TIMER

Definition at line 8 of file SpawnSystem.cpp.