Boss utworzony, strzela, bombuje, wiazkuje(#KolizjaToDo)
This commit is contained in:
63
headers/Boss.h
Normal file
63
headers/Boss.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#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 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; }
|
||||
|
||||
private:
|
||||
float movementSpeed = 1.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;
|
||||
|
||||
void setRandomDirection();
|
||||
void handleBounds();
|
||||
};
|
||||
|
||||
#endif // BOSS_H
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "Heart.hpp"
|
||||
#include "PowerUp.h"
|
||||
#include "Size.h"
|
||||
#include "Boss.h"
|
||||
|
||||
enum ships{
|
||||
nova,
|
||||
@@ -49,10 +50,14 @@ 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 boss; // Usuwanie wskaźnika bossa
|
||||
}
|
||||
|
||||
static ships selectedShip;
|
||||
@@ -86,6 +91,7 @@ private:
|
||||
sf::Texture advancedEnemyTexture;
|
||||
sf::Texture BomberEnemyTexture;
|
||||
sf::Texture BombaTexture;
|
||||
sf::Texture BossTexture;
|
||||
sf::Texture KamikadzeTexture;
|
||||
sf::Texture WiazkowiecTexture;
|
||||
sf::Texture WiazkaTexture;
|
||||
@@ -105,6 +111,9 @@ private:
|
||||
std::vector<Heart> hearts;
|
||||
std::vector<sf::Sprite> heartStats;
|
||||
std::vector<PowerUp> powerUps;
|
||||
Boss* boss = nullptr; // Wskaźnik na bossa
|
||||
sf::Clock bossSpawnClock; // Zegar do spawnowania bossa
|
||||
bool bossSpawned = false; // Flaga informująca, czy boss został już zespawnowany
|
||||
bool gameOver = false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user