Merge branch 'BossV1'

# Conflicts:
#	CMakeLists.txt
#	headers/Plansza.h
#	sources/Plansza.cpp
This commit is contained in:
2025-01-16 08:01:02 +01:00
7 changed files with 398 additions and 8 deletions

72
headers/Boss.h Normal file
View File

@@ -0,0 +1,72 @@
#ifndef BOSS_H
#define BOSS_H
#include "Actor.h"
#include "Bullet.h"
#include "Beam.h"
#include <vector>
#include <SFML/Graphics.hpp>
enum class BossDirection {
Up,
Down,
Left,
Right
};
class Boss : public Actor {
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;
void moveDown() override;
void shoot() override;
void dropBomb();
void shootLaser();
void move(float deltaX, float deltaY) override;
void update();
void takeDamage();
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 = 5.5f;
BossDirection direction = BossDirection::Down;
sf::Clock shootClock;
sf::Clock bombClock;
sf::Clock laserClock;
sf::Clock directionClock;
sf::Clock beamDurationClock;
float beamDuration = 1.0f;
sf::Texture bulletTexture;
sf::Texture BombaTexture;
sf::Texture beamTexture;
sf::RenderWindow* window;
Beam* laserBeam = nullptr;
std::vector<Bullet> bullets;
std::vector<Bullet> bombs;
int planszaHeight = 800;
int planszaWidth = 600;
bool isStationary = false;
void setRandomDirection();
void handleBounds();
};
#endif // BOSS_H

View File

@@ -18,6 +18,7 @@
#include "PowerUp.h"
#include "Debuff.h"
#include "Size.h"
#include "Boss.h"
enum ships{
nova,
@@ -53,16 +54,17 @@ public:
void spawn_enemy();
void spawn_advanced_enemy();
void spawn_wiazkowiec();
void spawn_boss();
void spawn_bomber();
void spawn_kamikadze();
~Plansza() {
delete ship; // usuwanie wskaźnika ship
delete ship;
delete boss;
}
static ships selectedShip;
static unsigned int score;
sf::Font font;
private:
Background background;
AudioManager audioManager;
@@ -100,6 +102,7 @@ private:
sf::Texture advancedEnemyTexture;
sf::Texture BomberEnemyTexture;
sf::Texture BombaTexture;
sf::Texture BossTexture;
sf::Texture KamikadzeTexture;
sf::Texture WiazkowiecTexture;
sf::Texture WiazkaTexture;
@@ -127,7 +130,13 @@ private:
std::vector<Debuff> debuffs;
// Zmienne prymitywne
Boss* boss = nullptr; // Wskaźnik na bossa
sf::Clock bossSpawnClock; // Zegar do spawnowania bossa
unsigned int nextBossScoreThreshold = 1; // Próg punktowy dla spawnu bossa
bool bossSpawned = false; // Flaga informująca, czy boss został już zespawnowany
bool gameOver = false;
// Używane do powerup i debuff flagi
struct {
bool movingSpeed = false;
bool firerate = false;