diff --git a/Faceball2030/assets/map/map1.map b/Faceball2030/assets/map/map1.map index 10172cd..1c31d41 100644 --- a/Faceball2030/assets/map/map1.map +++ b/Faceball2030/assets/map/map1.map @@ -1,44 +1,44 @@ 7 6 -32777 -32778 +41369 +41514 8202 -8728 -24584 8200 +16792 +9160 8204 40965 -57753 -24584 -25104 +49561 +8744 +24576 8192 -16784 -8196 +16384 +24996 8197 8193 -8192 +416 8194 8192 -16272 -16276 -8193 +8192 +8196 +8737 2 -25492 -8201 -16272 +24580 +16937 8192 -16276 +8192 +8196 8197 8351 8197 -8195 +8595 8198 273 -16276 +8196 8195 8602 8194 8202 8202 8194 -16278 +25126 diff --git a/Faceball2030/main.cpp b/Faceball2030/main.cpp index 9d2ba3f..be9f6c8 100644 --- a/Faceball2030/main.cpp +++ b/Faceball2030/main.cpp @@ -325,7 +325,15 @@ void FaceBall::LoadLevel(int level) mapFloor.tris.push_back({ {{(float)x + 1,0,(float)y},{(float)x,0,(float)y + 1},{(float)x + 1,0,(float)y + 1}},{{1,0},{0,1},{1,1}},{WHITE,WHITE,WHITE}, floor_tex }); EnemyID id = mapData[y][x].enemyId; if (id>=SHOOTME&& id < POWERUP_ARMOR) { - enemies.push_back({ id,vec3d{x + 0.5f,0,y + 0.5f},((int)mapData[y][x].facingDir-1)*PI/2,enemyData[id].radius}); + if (mapData[y][x].wave1) { + enemies.push_back({ id,vec3d{x + 0.5f,0,y + 0.5f},((int)mapData[y][x].facingDir - 1) * PI / 2,enemyData[id].radius }); + } else + if (mapData[y][x].wave2) { + wave2Enemies.push_back({ id,vec3d{x + 0.5f,0,y + 0.5f},((int)mapData[y][x].facingDir - 1) * PI / 2,enemyData[id].radius }); + } + else { + wave3Enemies.push_back({ id,vec3d{x + 0.5f,0,y + 0.5f},((int)mapData[y][x].facingDir - 1) * PI / 2,enemyData[id].radius }); + } } if (id >= POWERUP_ARMOR) { SpawnPowerup(PowerupType((int)id-55), vec3d{ x + 0.5f,0,y + 0.5f }); @@ -1422,10 +1430,9 @@ void FaceBall::HandleKeys(float fElapsedTime) { else { pitch = 0; if (GetMouse(0).bPressed) { - if (bullets.size() >= shotLimit) { - bullets.erase(bullets.begin()); + if (bullets.size() < shotLimit) { + bullets.push_back({ bullet,{player.GetPos().x,player.GetPos().y - 0.15f, player.GetPos().z},fYaw,0.125f,{shotSpd * std::cosf(fYaw),shotSpd * std::sinf(fYaw)},GREEN,true }); } - bullets.push_back({ bullet,{player.GetPos().x,player.GetPos().y - 0.15f, player.GetPos().z},fYaw,0.125f,{shotSpd * std::cosf(fYaw),shotSpd * std::sinf(fYaw)},GREEN,true }); } } if (GetKey(Q).bHeld) { @@ -2123,6 +2130,47 @@ bool FaceBall::OnUserUpdate(float fElapsedTime) if (camoDuration >= 0) { camoDuration -= fElapsedTime; } + if (EnemiesAlive() < 5) { + if (tagsRemaining <= 0) { + //Look at all wave 2 enemies first, if we can't spawn one in then look at wave 3 enemies, and try to spawn one in. + if (wave2Enemies.size()>0){ + for (int i=0;i0){ + for (int i=0;i::iterator it = bullets.begin(); it != bullets.end();) { Bullet& b = *it; if (!b.Update(fElapsedTime)) { @@ -2262,6 +2310,16 @@ void FaceBall::ResetScore() { lastAwardedScore = 0; } +int FaceBall::EnemiesAlive(){ + int alive=0; + for (Enemy&e:enemies){ + if (!e.isDead()){ + alive++; + } + } + return alive; +} + int main() { FaceBall demo; diff --git a/Faceball2030/main.h b/Faceball2030/main.h index 9b75bb0..e3481fd 100644 --- a/Faceball2030/main.h +++ b/Faceball2030/main.h @@ -266,6 +266,8 @@ class FaceBall : public PixelGameEngine std::mapenemyData; std::mappowerupData; std::vectorenemies; + std::vectorwave2Enemies; + std::vectorwave3Enemies; std::vectorpowerups; private: Mesh mapWalls,mapFloor,enemy_ShootMe,undefined, @@ -397,6 +399,7 @@ class FaceBall : public PixelGameEngine void Display3DKillerModel(); int CheckPowerupCollision(vec3d movementVector, vf2d pos, float radius); void ResetScore(); + int EnemiesAlive(); public: vi2d MAP_SIZE; float restingTriangleYDepth = 0.f;