Monster spawning now adds to a queue to prevent memory adjustment corruption while inside of monster update functions.

Monster spawning on phase transition now occurs.
This commit is contained in:
2023-09-19 03:30:18 -05:00
parent c816a0eac7
commit 74a31dda2e
7 changed files with 62 additions and 5 deletions
+8
View File
@@ -121,6 +121,10 @@ bool Crawler::OnUserUpdate(float fElapsedTime){
for(Monster&m:MONSTER_LIST){
m.Update(fElapsedTime);
}
for(Monster&m:monstersToBeSpawned){
MONSTER_LIST.push_back(m);
}
monstersToBeSpawned.clear();
UpdateBullets(fElapsedTime);
UpdateCamera(fElapsedTime);
RenderWorld(fElapsedTime);
@@ -1374,4 +1378,8 @@ void Crawler::InitializeLevels(){
INITLEVEL(CAMPAIGN_1_2);
LEVEL_NAMES.SetInitialized();
}
void Crawler::SpawnMonster(vf2d pos,MonsterData*data,bool upperLevel){
monstersToBeSpawned.push_back(Monster(pos,*data,upperLevel));
}