SpawnManager - ZenXChaos/MapleStorySDLCPP GitHub Wiki

Spawn Manager

SpawnManager.h // SpawnManager.cpp : Spawn Manager handles the spawning of Mobs.

private members:

Uint32 lastSpawn = 0;
Uint32 lastSpawnIndex = 0;
size_t SpawnEvery = 3;

SDL_Rect spawnPoints[10] = {{0,0,0,0}};

size_t maxSpawn = 3;

public members:

std::map<std::string, Entity>* MobList;
std::vector<Entity> spawned;

void ManagePool(Uint32 tick);

lastSpawn: In seconds, the last time a mob was spawned

lastSpawnIndex: Used as a variable to track last time a mob was spawned relative to current time.

spawnEvery: In seconds, spawn a mob

maxSpawn: Maximum numbers of mobs that can be spawned at any given moment

MobList: A list reference of all mobs that exist in the game.

spawned: Vector of all spawned mobs (current)

void ManagePool: The actual manager code is here.

⚠️ **GitHub.com Fallback** ⚠️