diff --git a/Faceball2030/Editor.cpp b/Faceball2030/Editor.cpp index e11ebe0..29658fb 100644 --- a/Faceball2030/Editor.cpp +++ b/Faceball2030/Editor.cpp @@ -295,7 +295,8 @@ void Editor::OnTextEntryComplete(const std::string& sText) { MAP_SIZE = { (int)map[0].size(),(int)map.size() }; } else { - reEnableTextEntry = true; + game->TextEntryEnable(false); + promptState = PromptState::NONE; } }break; case PromptState::ENTER_WIDTH: { diff --git a/Faceball2030/Editor.h b/Faceball2030/Editor.h index bee07d7..fda6bb0 100644 --- a/Faceball2030/Editor.h +++ b/Faceball2030/Editor.h @@ -28,6 +28,7 @@ enum EnemyID { ISHOOT2, SHOOTME_ARMOR, ISHOOT_MAP, + ISHOOT2_SPEED, SONAR, POWERUP_ARMOR = 56, POWERUP_SPEED = 57, diff --git a/Faceball2030/assets/enemies/IShoot2.png b/Faceball2030/assets/enemies/IShoot2.png index 490b339..8d9011e 100644 Binary files a/Faceball2030/assets/enemies/IShoot2.png and b/Faceball2030/assets/enemies/IShoot2.png differ diff --git a/Faceball2030/assets/enemies/IShoot2.xcf b/Faceball2030/assets/enemies/IShoot2.xcf index 564a6fa..3921fff 100644 Binary files a/Faceball2030/assets/enemies/IShoot2.xcf and b/Faceball2030/assets/enemies/IShoot2.xcf differ diff --git a/Faceball2030/assets/map/map3.map b/Faceball2030/assets/map/map3.map index b833b38..9a0240f 100644 --- a/Faceball2030/assets/map/map3.map +++ b/Faceball2030/assets/map/map3.map @@ -1,27 +1,51 @@ -5 -5 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 -8192 +7 +7 +17193 +8202 +24586 +424 +8202 +25370 +16924 +1221 +8201 +8204 +8597 +8201 +8204 +17221 +8197 +8195 +8198 +837 +24579 +8198 +837 +8721 +8202 +8202 +8192 +8202 +8202 +25444 +8197 +11 +8204 +24581 +9 +8204 +8197 +8197 +8351 +8199 +25381 +8195 +8198 +8197 +9027 +24986 +8202 +8194 +8746 +24586 +278 diff --git a/Faceball2030/main.cpp b/Faceball2030/main.cpp index 093c6f6..6cda4bf 100644 --- a/Faceball2030/main.cpp +++ b/Faceball2030/main.cpp @@ -264,8 +264,10 @@ void FaceBall::InitializeEnemyData() { enemyData[SHOOTME] = { "SHOOTME",enemy_ShootMe,YELLOW,1,1,0.5,2,1,0.2f,true }; enemyData[SHOOTME2] = { "SHOOTME2",enemy_ShootMe2,YELLOW,1,1,PI / 6,2,1,0.35f,true }; enemyData[ISHOOT] = { "ISHOOT",enemy_IShoot,YELLOW,1,1,0.5,2,3,0.4f,true }; + enemyData[ISHOOT2] = { "ISHOOT2",enemy_IShoot2,YELLOW,1,1,PI / 6,2,1,0.35f,true }; enemyData[SHOOTME_ARMOR] = { "SHOOTME",enemy_ShootMe,YELLOW,6,1,0.5,2,1,0.3f,true,PowerupType::ARMOR,true }; enemyData[ISHOOT_MAP] = { "ISHOOT",enemy_IShoot,YELLOW,7,1,0.5,2,2,0.3f,true,PowerupType::MAP,true }; + enemyData[ISHOOT2_SPEED] = { "ISHOOT2",enemy_IShoot2,YELLOW,6,1,PI / 6,2,1,0.35f,true,PowerupType::SPEED,true }; enemyData[SONAR] = { "Sonar",enemy_Sonar,RED,5,1,PI / 8,2,1 }; enemyData[COIN] = { "Coin",undefined,BLUE }; enemyData[POWERUP_ARMOR] = { "Armor",undefined,{96,0,96} }; @@ -1496,6 +1498,16 @@ void FaceBall::RenderWorld() { } } +int FaceBall::PlayerActiveShotCount(int playerNumb){ + int count=0; + for (Bullet&b:bullets){ + if (b.playerIndex==playerNumb){ + count++; + } + } + return count; +} + void FaceBall::HandleKeys(float fElapsedTime) { vec3d vForward = Vector_Mul(vLookDir, std::min(player.GetRadius()-0.00001f,moveSpd*fElapsedTime)); if (freeRoam) { @@ -1509,8 +1521,10 @@ void FaceBall::HandleKeys(float fElapsedTime) { else { pitch = 0; if (GetMouse(0).bPressed) { - 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 }); + if (PlayerActiveShotCount(0) < shotLimit) { + Bullet newBullet={ 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 }; + newBullet.playerIndex=0; + bullets.push_back(newBullet); } } } @@ -1742,6 +1756,7 @@ bool FaceBall::OnUserCreate() exit_wall_tex = new Decal(new Sprite("assets/exitwall.png")); enemy_ShootMe2_tex = new Decal(new Sprite("assets/enemies/ShootMe2.png")); enemy_IShoot_tex = new Decal(new Sprite("assets/enemies/IShoot.png")); + enemy_IShoot2_tex = new Decal(new Sprite("assets/enemies/IShoot2.png")); life4 = new Decal(new Sprite("assets/life4.png")); life3 = new Decal(new Sprite("assets/life3.png")); life2 = new Decal(new Sprite("assets/life2.png")); @@ -1756,6 +1771,7 @@ bool FaceBall::OnUserCreate() enemy_ShootMe2 = { "assets/enemies/ShootMe2.obj", enemy_ShootMe2_tex }; enemy_Sonar = { "assets/enemies/Sonar.obj", enemy_Sonar_tex }; enemy_IShoot = { "assets/enemies/IShoot.obj", enemy_IShoot_tex}; + enemy_IShoot2 = { "assets/enemies/IShoot2.obj", enemy_IShoot2_tex}; bullet = { "assets/enemies/bullet.obj",bullet_tex }; powerup = { "assets/Powerup.obj",powerup_tex}; powerup2 = { "assets/Powerup2.obj",powerup2_tex }; @@ -1769,7 +1785,7 @@ bool FaceBall::OnUserCreate() InitializeEnemyData(); InitializePowerupColors(); - LoadLevel(1); + LoadLevel(level); return true; } @@ -2203,7 +2219,8 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) { e.ShootBullet(myIndex); } }break; - case ISHOOT2: { + case ISHOOT2: + case ISHOOT2_SPEED:{ switch (e.GetPhase()) { case Phase::DEFAULT: { vf2d movementVec = { std::cosf(e.rot) * dat.movSpd * fElapsedTime,std::sinf(e.rot) * dat.movSpd * fElapsedTime }; @@ -2526,7 +2543,7 @@ int FaceBall::EnemiesAlive(){ int main() { FaceBall demo; - if (demo.Construct(1280, 720, 2, 2)) + if (demo.Construct(1280, 720, 2, 2, false, true)) demo.Start(); return 0; } diff --git a/Faceball2030/main.h b/Faceball2030/main.h index 885ed6d..3bbbe67 100644 --- a/Faceball2030/main.h +++ b/Faceball2030/main.h @@ -153,6 +153,7 @@ struct Bullet : Object{ EnemyID shooterID; int shooterIndex = -1; bool shooterBlinking = false; + int playerIndex = -1; bool Update(float fElapsedTime); }; @@ -262,7 +263,7 @@ class FaceBall : public PixelGameEngine private: Mesh mapWalls,mapFloor,enemy_ShootMe,undefined, enemy_Sonar, mapExit,enemy_ShootMe2,powerup,powerup2, - enemy_IShoot; + enemy_IShoot,enemy_IShoot2; Sprite*mapSpr; Decal*mapDecal; @@ -272,7 +273,7 @@ class FaceBall : public PixelGameEngine Decal* dot, * enemy_ShootMe_tex,*bullet_tex,*wall_tex,*floor_tex, *enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_ShootMe2_tex,*enemy_IShoot_tex, *life4,*life3,*life2,*life1,*crosshair,*hudmeter,*powerup_tex,*powerup2_tex, - *powerups_tex; + *powerups_tex,*enemy_IShoot2_tex; vi2d exitCoords = { 0,0 }; std::vectorknownGoodPositions; std::vector>map; @@ -281,7 +282,7 @@ class FaceBall : public PixelGameEngine Editor editor; int MapWallsObjectIndex = -1; bool exitWallsCleared = false; - int level=1; + int level=3; int tagsRemaining = 10; int lives = 3; double gameTimer = 0; @@ -421,6 +422,7 @@ public: int CheckPowerupCollision(vec3d movementVector, vf2d pos, float radius); void ResetScore(); int EnemiesAlive(); + int PlayerActiveShotCount(int playerNumb); public: vi2d MAP_SIZE; float restingTriangleYDepth = 0.f;