Kolizja wiazki dodana

This commit is contained in:
2025-01-14 13:52:05 +01:00
parent 629b1279a9
commit baced5f971
4 changed files with 83 additions and 23 deletions

View File

@@ -19,6 +19,8 @@ public:
Boss(int x, int y, const sf::Texture &bossTexture, const sf::Texture &bulletTexture, sf::Texture BombaTexture,
sf::RenderWindow *window);
void setPlanszaHeight(int height, int width);
void moveLeft() override;
void moveRight() override;
void moveUp() override;
@@ -35,9 +37,11 @@ public:
bool isAlive() const;
std::vector<Bullet>& getBullets() { return bullets; }
std::vector<Bullet>& getBombs() { return bombs; }
bool isShooting() const { return laserBeam != nullptr; }
Beam* getBeam() const { return laserBeam; }
private:
float movementSpeed = 1.5f;
float movementSpeed = 5.5f;
BossDirection direction = BossDirection::Down;
sf::Clock shootClock;
@@ -56,6 +60,11 @@ private:
std::vector<Bullet> bullets;
std::vector<Bullet> bombs;
int planszaHeight = 800;
int planszaWidth = 600;
bool isStationary = false;
void setRandomDirection();
void handleBounds();
};

View File

@@ -56,8 +56,8 @@ public:
void spawn_bomber();
void spawn_kamikadze();
~Plansza() {
delete ship; // usuwanie wskaźnika ship
delete boss; // Usuwanie wskaźnika bossa
delete ship;
delete boss;
}
static ships selectedShip;
@@ -115,6 +115,7 @@ private:
sf::Clock bossSpawnClock; // Zegar do spawnowania bossa
bool bossSpawned = false; // Flaga informująca, czy boss został już zespawnowany
bool gameOver = false;
unsigned int nextBossScoreThreshold = 1; // Próg punktowy dla spawnu bossa
};
#endif //PLANSZA_H