Compare commits
6 Commits
b257837d18
...
5Przeciwni
| Author | SHA1 | Date | |
|---|---|---|---|
| 87399213b3 | |||
| f1dc19e795 | |||
| 168ba2e477 | |||
| 38fd71b8e6 | |||
| 1c0e5d0293 | |||
| c898aa0d81 |
@@ -36,6 +36,10 @@ add_executable(LotoStatek main.cpp
|
|||||||
sources/Bomber.cpp
|
sources/Bomber.cpp
|
||||||
headers/Kamikadze.h
|
headers/Kamikadze.h
|
||||||
sources/Kamikadze.cpp
|
sources/Kamikadze.cpp
|
||||||
|
headers/wiazkowiec.h
|
||||||
|
sources/Wiazkowiec.cpp
|
||||||
|
headers/Beam.h
|
||||||
|
sources/Beam.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|||||||
BIN
assets/img/enemy/bomber.png
Normal file
BIN
assets/img/enemy/bomber.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
assets/img/wiazka/wiazka.png
Normal file
BIN
assets/img/wiazka/wiazka.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
29
headers/Beam.h
Normal file
29
headers/Beam.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#ifndef LOTOSTATEK_BEAM_H
|
||||||
|
#define LOTOSTATEK_BEAM_H
|
||||||
|
|
||||||
|
#include <SFML/Graphics.hpp>
|
||||||
|
#include "Position.h"
|
||||||
|
|
||||||
|
class Beam {
|
||||||
|
public:
|
||||||
|
Beam(float x, float y, float width, float height, const sf::Color& color);
|
||||||
|
|
||||||
|
void draw(sf::RenderWindow &window);
|
||||||
|
|
||||||
|
void update();
|
||||||
|
void render(sf::RenderWindow& window);
|
||||||
|
|
||||||
|
sf::FloatRect getBounds() const;
|
||||||
|
|
||||||
|
bool isVisible() const;
|
||||||
|
void setVisible(bool visible);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
sf::RectangleShape beamShape;
|
||||||
|
bool visible;
|
||||||
|
sf::Texture beamTexture;
|
||||||
|
sf::Sprite beamSprite;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LOTOSTATEK_BEAM_H
|
||||||
@@ -31,8 +31,11 @@ public:
|
|||||||
bool isAlive() const;
|
bool isAlive() const;
|
||||||
void takeDamage();
|
void takeDamage();
|
||||||
void updateDirection();
|
void updateDirection();
|
||||||
|
void setPlanszaHeight(float height, float width);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
float planszaHeight = 800.f;
|
||||||
|
float planszaWidth = 600.f;
|
||||||
sf::Clock shootClock;
|
sf::Clock shootClock;
|
||||||
sf::Texture BombaTexture;
|
sf::Texture BombaTexture;
|
||||||
float movementSpeed = 2.0f;
|
float movementSpeed = 2.0f;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
void explode(const sf::Vector2f &playerPosition, bool &playerHit);
|
void explode(const sf::Vector2f &playerPosition, bool &playerHit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool exploding = false; // Czy kamikadze obecnie eksploduje
|
bool exploding = false;
|
||||||
sf::Clock explosionClock;
|
sf::Clock explosionClock;
|
||||||
sf::Clock shootClock;
|
sf::Clock shootClock;
|
||||||
float movementSpeed = 2.0f;
|
float movementSpeed = 2.0f;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "AdvancedEnemy.h"
|
#include "AdvancedEnemy.h"
|
||||||
#include "Bomber.h"
|
#include "Bomber.h"
|
||||||
#include "Kamikadze.h"
|
#include "Kamikadze.h"
|
||||||
|
#include "Wiazkowiec.h"
|
||||||
|
#include "Beam.h"
|
||||||
#include "RandomNumberGenerator.h"
|
#include "RandomNumberGenerator.h"
|
||||||
#include "SFML/System/Clock.hpp"
|
#include "SFML/System/Clock.hpp"
|
||||||
#include "SFML/Graphics/RenderWindow.hpp"
|
#include "SFML/Graphics/RenderWindow.hpp"
|
||||||
@@ -44,6 +46,7 @@ private:
|
|||||||
sf::Texture meteorTexture1;
|
sf::Texture meteorTexture1;
|
||||||
sf::Texture meteorTexture2;
|
sf::Texture meteorTexture2;
|
||||||
sf::Texture enemyBulletTexture;
|
sf::Texture enemyBulletTexture;
|
||||||
|
sf::Texture WiazkaTexture;
|
||||||
sf::Texture BombaTexture;
|
sf::Texture BombaTexture;
|
||||||
sf::Texture playerTexture;
|
sf::Texture playerTexture;
|
||||||
sf::Texture playerBulletTexture;
|
sf::Texture playerBulletTexture;
|
||||||
@@ -52,16 +55,19 @@ private:
|
|||||||
sf::Texture advancedEnemyTexture;
|
sf::Texture advancedEnemyTexture;
|
||||||
sf::Texture BomberEnemyTexture;
|
sf::Texture BomberEnemyTexture;
|
||||||
sf::Texture KamikadzeTexture;
|
sf::Texture KamikadzeTexture;
|
||||||
|
sf::Texture WiazkowiecTexture;
|
||||||
sf::Clock spawnClock;
|
sf::Clock spawnClock;
|
||||||
sf::Clock shooterSpawnClock;
|
sf::Clock shooterSpawnClock;
|
||||||
std::vector<Enemy> enemies;
|
std::vector<Enemy> enemies;
|
||||||
std::vector<AdvancedEnemy> AEnemies;
|
std::vector<AdvancedEnemy> AEnemies;
|
||||||
std::vector<Bomber> BEnemies;
|
std::vector<Bomber> BEnemies;
|
||||||
std::vector<Kamikadze> KEnemies;
|
std::vector<Kamikadze> KEnemies;
|
||||||
|
std::vector<Wiazkowiec> WEnemies;
|
||||||
sf::Clock enemySpawnClock;
|
sf::Clock enemySpawnClock;
|
||||||
sf::Clock AenemySpawnClock;
|
sf::Clock AenemySpawnClock;
|
||||||
sf::Clock BomberSpawnClock;
|
sf::Clock BomberSpawnClock;
|
||||||
sf::Clock KamikadzeSpawnClock;
|
sf::Clock KamikadzeSpawnClock;
|
||||||
|
sf::Clock WiazkowiecSpawnClock;
|
||||||
std::vector<Meteor> meteors;
|
std::vector<Meteor> meteors;
|
||||||
sf::RenderWindow *window;
|
sf::RenderWindow *window;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <SFML/System/Clock.hpp>
|
||||||
|
|
||||||
#include "Actor.h"
|
#include "Actor.h"
|
||||||
#include "Rocket.h"
|
#include "Rocket.h"
|
||||||
|
|
||||||
@@ -20,6 +22,7 @@ public:
|
|||||||
void moveDown() override;
|
void moveDown() override;
|
||||||
void takeDamage();
|
void takeDamage();
|
||||||
bool isAlive() const;
|
bool isAlive() const;
|
||||||
|
void update();
|
||||||
std::vector<Rocket>& getRockets();
|
std::vector<Rocket>& getRockets();
|
||||||
private:
|
private:
|
||||||
std::chrono::steady_clock::time_point lastShotTime = std::chrono::steady_clock::now();
|
std::chrono::steady_clock::time_point lastShotTime = std::chrono::steady_clock::now();
|
||||||
@@ -27,6 +30,9 @@ private:
|
|||||||
sf::Texture rocketTexture;
|
sf::Texture rocketTexture;
|
||||||
int health = 3; // Liczba punktów życia gracza
|
int health = 3; // Liczba punktów życia gracza
|
||||||
sf::Texture bulletTexture;
|
sf::Texture bulletTexture;
|
||||||
|
bool isImmortal = false; // flaga na immortal
|
||||||
|
sf::Clock immortalityClock; // Zegar kontrolujący czas nieśmiertelności
|
||||||
|
float immortalityDuration = 1.5f; // Czas trwania nieśmiertelności w sec
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
54
headers/Wiazkowiec.h
Normal file
54
headers/Wiazkowiec.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#ifndef WIAZKOWIEC_H
|
||||||
|
#define WIAZKOWIEC_H
|
||||||
|
|
||||||
|
#include "Enemy.h"
|
||||||
|
#include "Actor.h"
|
||||||
|
#include "Beam.h"
|
||||||
|
enum class DirectionW {
|
||||||
|
Up,
|
||||||
|
Down,
|
||||||
|
Left,
|
||||||
|
Right
|
||||||
|
};
|
||||||
|
|
||||||
|
class Wiazkowiec : public Actor {
|
||||||
|
public:
|
||||||
|
Wiazkowiec(int x, int y, const sf::Texture& texture);
|
||||||
|
|
||||||
|
void shoot() override;
|
||||||
|
void move(float deltaX, float deltaY) override;
|
||||||
|
void moveLeft() override;
|
||||||
|
void moveRight() override;
|
||||||
|
void moveUp() override;
|
||||||
|
void moveDown() override;
|
||||||
|
void setRandomDirection();
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
|
void render(sf::RenderWindow &window);
|
||||||
|
|
||||||
|
bool isAlive() const;
|
||||||
|
void takeDamage();
|
||||||
|
void updateDirection();
|
||||||
|
bool isShooting() const;
|
||||||
|
const Beam& getBeam() const;
|
||||||
|
void setPlanszaHeight(float height, float width);
|
||||||
|
void setMapBounds(float width, float height);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
float planszaHeight = 800.f;
|
||||||
|
float planszaWidth = 600.f;
|
||||||
|
sf::Clock shootClock;
|
||||||
|
sf::Texture WiazkaTexture;
|
||||||
|
float movementSpeed = 2.0f;
|
||||||
|
bool alive = true;
|
||||||
|
DirectionW direction = DirectionW::Down;
|
||||||
|
Beam beam; // Wiązka
|
||||||
|
bool shooting = false;
|
||||||
|
sf::Clock shootingClock;
|
||||||
|
float beamDuration = 1.0f;
|
||||||
|
void spawnBeam(); // Tworzy wiązkę
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //WIAZKOWIEC_H
|
||||||
51
sources/Beam.cpp
Normal file
51
sources/Beam.cpp
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
#include "../headers/Beam.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
Beam::Beam(float x, float y, float width, float height, const sf::Color& color)
|
||||||
|
: visible(false) {
|
||||||
|
beamShape.setPosition(x, y);
|
||||||
|
beamShape.setSize({width, height});
|
||||||
|
beamShape.setFillColor(color);
|
||||||
|
|
||||||
|
if (!beamTexture.loadFromFile("../assets/img/wiazka/wiazka.png")) {
|
||||||
|
std::cerr << "Błąd! Nie można załadować tekstury wiazka.png" << std::endl;
|
||||||
|
}
|
||||||
|
beamSprite.setTexture(beamTexture);
|
||||||
|
|
||||||
|
if (beamTexture.getSize().x > 0 && beamTexture.getSize().y > 0) {
|
||||||
|
float scaleX = width / beamTexture.getSize().x;
|
||||||
|
float scaleY = height / beamTexture.getSize().y;
|
||||||
|
beamSprite.setScale(scaleX, scaleY);
|
||||||
|
beamSprite.setPosition(x, y);
|
||||||
|
} else {
|
||||||
|
std::cerr << "Błąd: Tekstura wiązki nie została poprawnie załadowana." << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Beam::draw(sf::RenderWindow& window) {
|
||||||
|
|
||||||
|
window.draw(beamSprite);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Beam::update() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Beam::render(sf::RenderWindow& window) {
|
||||||
|
window.draw(beamSprite);
|
||||||
|
}
|
||||||
|
|
||||||
|
sf::FloatRect Beam::getBounds() const {
|
||||||
|
return beamShape.getGlobalBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Beam::isVisible() const {
|
||||||
|
return visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Beam::setVisible(bool visible) {
|
||||||
|
this->visible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -7,11 +7,14 @@ Bomber::Bomber(int x, int y, const sf::Texture& texture, const sf::Texture& bull
|
|||||||
BombaTexture = bulletTexture;
|
BombaTexture = bulletTexture;
|
||||||
hp = 2; // 2 punkty życia
|
hp = 2; // 2 punkty życia
|
||||||
firerate = 10000; // Strzela co 10
|
firerate = 10000; // Strzela co 10
|
||||||
moving_speed = 1.0f; // Prędkość
|
moving_speed = 10.0f; // Prędkość
|
||||||
// BombaTexture.loadFromFile("../assets/img/bullets/bomba.png");
|
}
|
||||||
|
|
||||||
|
void Bomber::setPlanszaHeight(float height, float width) {
|
||||||
|
planszaHeight = height;
|
||||||
|
planszaWidth = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Losuje losowy kierunek dla Bombera
|
|
||||||
void Bomber::setRandomDirection() {
|
void Bomber::setRandomDirection() {
|
||||||
std::random_device rd;
|
std::random_device rd;
|
||||||
std::mt19937 gen(rd());
|
std::mt19937 gen(rd());
|
||||||
@@ -25,13 +28,13 @@ void Bomber::setRandomDirection() {
|
|||||||
if (position.y > 0) direction = DirectionB::Up;
|
if (position.y > 0) direction = DirectionB::Up;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (position.y < 800) direction = DirectionB::Down;
|
if (position.y < 600) direction = DirectionB::Down;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (position.x > 0) direction = DirectionB::Left;
|
if (position.x > 0) direction = DirectionB::Left;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (position.x < 600) direction = DirectionB::Right;
|
if (position.x < 800) direction = DirectionB::Right;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,22 +50,39 @@ void Bomber::shoot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Bomber::updateDirection() {
|
void Bomber::updateDirection() {
|
||||||
// Zmieniamy kierunek przeciwnika, gdy dotrze do krawędzi
|
auto spriteBounds = actorSprite.getGlobalBounds(); // Pobierz rozmiar i pozycję sprite'a
|
||||||
|
|
||||||
|
// Kontrola górnej i dolnej krawędzi (wysokości planszy)
|
||||||
if (position.y <= 0) {
|
if (position.y <= 0) {
|
||||||
direction = DirectionB::Down;
|
direction = DirectionB::Down;
|
||||||
} else if (position.y >= 800) {
|
} else if (position.y + spriteBounds.height >= planszaHeight) {
|
||||||
direction = DirectionB::Up;
|
direction = DirectionB::Up;
|
||||||
}
|
}
|
||||||
|
|
||||||
// logika dla kierunku lewo/prawo
|
// Kontrola lewej i prawej krawędzi (szerokości planszy)
|
||||||
if (position.x <= 0) {
|
if (position.x <= 0) {
|
||||||
direction = DirectionB::Right;
|
direction = DirectionB::Right;
|
||||||
} else if (position.x >= 1200) {
|
} else if (position.x + spriteBounds.width >= planszaWidth) {
|
||||||
direction = DirectionB::Left;
|
direction = DirectionB::Left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bomber::move(float deltaX, float deltaY) {
|
void Bomber::move(float deltaX, float deltaY) {
|
||||||
|
auto spriteBounds = actorSprite.getGlobalBounds(); // Rozmiar i pozycja sprite'a
|
||||||
|
|
||||||
|
// Zapobiegaj wyjściu poza poziome granice
|
||||||
|
if (position.x + deltaX < 0) {
|
||||||
|
deltaX = -position.x;
|
||||||
|
} else if (position.x + spriteBounds.width + deltaX > planszaWidth) {
|
||||||
|
deltaX = planszaWidth - (position.x + spriteBounds.width);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zapobiegaj wyjściu poza pionowe granice
|
||||||
|
if (position.y + deltaY < 0) {
|
||||||
|
deltaY = -position.y;
|
||||||
|
} else if (position.y + spriteBounds.height + deltaY > planszaHeight) {
|
||||||
|
deltaY = planszaHeight - (position.y + spriteBounds.height);
|
||||||
|
}
|
||||||
actorSprite.move(deltaX, deltaY);
|
actorSprite.move(deltaX, deltaY);
|
||||||
position.x += static_cast<int>(deltaX);
|
position.x += static_cast<int>(deltaX);
|
||||||
position.y += static_cast<int>(deltaY);
|
position.y += static_cast<int>(deltaY);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "../headers/Kamikadze.h"
|
#include "../headers/Kamikadze.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "../headers/Bullet.h"
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
|
#include "../headers/RandomNumberGenerator.h"
|
||||||
|
|
||||||
Kamikadze::Kamikadze(int x, int y, const sf::Texture& texture) : Actor(x, y, texture) {
|
Kamikadze::Kamikadze(int x, int y, const sf::Texture& texture) : Actor(x, y, texture) {
|
||||||
actorSprite.setTexture(texture);
|
actorSprite.setTexture(texture);
|
||||||
hp = 3; // 3 punkty życia
|
hp = 3; // 3 punkty życia
|
||||||
@@ -13,13 +13,8 @@ Kamikadze::Kamikadze(int x, int y, const sf::Texture& texture) : Actor(x, y, tex
|
|||||||
|
|
||||||
void Kamikadze::shoot(){}
|
void Kamikadze::shoot(){}
|
||||||
|
|
||||||
// Losuje losowy kierunek dla Bombera
|
|
||||||
void Kamikadze::setRandomDirection() {
|
void Kamikadze::setRandomDirection() {
|
||||||
std::random_device rd;
|
int randomDirection = RandomNumberGenerator::getRandomNumber(0,3);
|
||||||
std::mt19937 gen(rd());
|
|
||||||
std::uniform_int_distribution<int> dist(0, 3);
|
|
||||||
|
|
||||||
int randomDirection = dist(gen);
|
|
||||||
|
|
||||||
// Zapobieganie wyjscia poza ekran
|
// Zapobieganie wyjscia poza ekran
|
||||||
switch (randomDirection) {
|
switch (randomDirection) {
|
||||||
@@ -56,31 +51,28 @@ void Kamikadze::updateDirection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Kamikadze::followPlayer(const sf::Vector2f& playerPosition) {
|
void Kamikadze::followPlayer(const sf::Vector2f& playerPosition) {
|
||||||
// Oblicz różnicę w pozycjach
|
|
||||||
float diffX = playerPosition.x - position.x;
|
float diffX = playerPosition.x - position.x;
|
||||||
float diffY = playerPosition.y - position.y;
|
float diffY = playerPosition.y - position.y;
|
||||||
|
|
||||||
// Normalizacja wektora (skrócenie kierunku do jednostkowego)
|
|
||||||
float magnitude = std::sqrt(diffX * diffX + diffY * diffY);
|
float magnitude = std::sqrt(diffX * diffX + diffY * diffY);
|
||||||
if (magnitude != 0) {
|
if (magnitude != 0) {
|
||||||
diffX /= magnitude;
|
diffX /= magnitude;
|
||||||
diffY /= magnitude;
|
diffY /= magnitude;
|
||||||
|
|
||||||
// Aktualizacja pozycji Kamikadze w kierunku gracza z uwzględnieniem prędkości
|
// Aktualizacja pozycji Kamikadze w kierunku gracza
|
||||||
position.x += diffX * movementSpeed;
|
position.x += diffX * movementSpeed;
|
||||||
position.y += diffY * movementSpeed;
|
position.y += diffY * movementSpeed;
|
||||||
} else {
|
} else { //zatrzymanie kamikadze
|
||||||
// Jeśli Kamikadze jest dokładnie na pozycji gracza, zatrzymaj jego ruch
|
|
||||||
movementSpeed = 0.0f;
|
movementSpeed = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Kamikadze::explode(const sf::Vector2f& playerPosition, bool& playerHit) {
|
void Kamikadze::explode(const sf::Vector2f& playerPosition, bool& playerHit) {
|
||||||
if (!exploding) {
|
if (!exploding) {
|
||||||
// Rozpocznij eksplozję
|
// Rozpocznij kamikadze
|
||||||
exploding = true;
|
exploding = true;
|
||||||
explosionClock.restart();
|
explosionClock.restart();
|
||||||
movementSpeed = 0.0f; // Zatrzymaj Kamikadze
|
movementSpeed = 0.0f;
|
||||||
|
|
||||||
std::cout << "Kamikadze exploding!" << std::endl;
|
std::cout << "Kamikadze exploding!" << std::endl;
|
||||||
std::cout << "Kamikadze position: (" << position.x << ", " << position.y << ")" << std::endl;
|
std::cout << "Kamikadze position: (" << position.x << ", " << position.y << ")" << std::endl;
|
||||||
@@ -121,9 +113,9 @@ void Kamikadze::moveDown() { move(0.0f, moving_speed); }
|
|||||||
|
|
||||||
void Kamikadze::update(const sf::Vector2f& playerPosition) {
|
void Kamikadze::update(const sf::Vector2f& playerPosition) {
|
||||||
if (alive && !exploding) {
|
if (alive && !exploding) {
|
||||||
// Podążaj za graczem, dopóki Kamikadze jest żywy i nie eksploduje
|
// Podążanie za graczem, dopóki Kamikadze jest żywy
|
||||||
followPlayer(playerPosition);
|
followPlayer(playerPosition);
|
||||||
actorSprite.setPosition(position.x, position.y); // Aktualizuj sprite
|
actorSprite.setPosition(position.x, position.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::Render
|
|||||||
std::cerr << "Failed to load advanced enemy texture!" << std::endl;
|
std::cerr << "Failed to load advanced enemy texture!" << std::endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
if (!BomberEnemyTexture.loadFromFile("../assets/img/enemy/wiazkowiec.png")) {
|
if (!BomberEnemyTexture.loadFromFile("../assets/img/enemy/bomber.png")) {
|
||||||
std::cerr << "Failed to load advanced enemy texture!" << std::endl;
|
std::cerr << "Failed to load advanced enemy texture!" << std::endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
@@ -50,6 +50,10 @@ Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::Render
|
|||||||
std::cerr << "Failed to load BombaTexture!" << std::endl;
|
std::cerr << "Failed to load BombaTexture!" << std::endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
if (!WiazkowiecTexture.loadFromFile("../assets/img/enemy/wiazkowiec.png")) {
|
||||||
|
std::cerr << "Failed to load Wiazkowiec texture!" << std::endl;
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
spawnClock.restart();
|
spawnClock.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,10 +96,11 @@ void Plansza::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// generowanie nowego meteoru
|
// generowanie nowego meteoru
|
||||||
//spawn_meteor();
|
ship.update();
|
||||||
|
spawn_meteor();
|
||||||
spawn_enemy();
|
spawn_enemy();
|
||||||
spawn_advanced_enemy();
|
spawn_advanced_enemy();
|
||||||
//spawn_wiazkowiec();
|
spawn_wiazkowiec();
|
||||||
spawn_bomber();
|
spawn_bomber();
|
||||||
spawn_kamikadze();
|
spawn_kamikadze();
|
||||||
|
|
||||||
@@ -249,7 +254,7 @@ void Plansza::update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto it = BEnemies.begin(); it != BEnemies.end();) {
|
for (auto it = BEnemies.begin(); it != BEnemies.end();) {
|
||||||
it->update(); // Ruch b
|
it->update(); // Ruch bombera
|
||||||
it->shoot(); // Strzał przeciwnika
|
it->shoot(); // Strzał przeciwnika
|
||||||
|
|
||||||
window->draw(it->getSprite()); // Rysowanie na ekranie
|
window->draw(it->getSprite()); // Rysowanie na ekranie
|
||||||
@@ -267,7 +272,6 @@ void Plansza::update() {
|
|||||||
sf::Vector2f playerPosition = ship.getSprite().getPosition(); // Aktualna pozycja gracza
|
sf::Vector2f playerPosition = ship.getSprite().getPosition(); // Aktualna pozycja gracza
|
||||||
bool playerHit = false;
|
bool playerHit = false;
|
||||||
|
|
||||||
// Aktualizacja pozycji Kamikadze
|
|
||||||
it->update(playerPosition);
|
it->update(playerPosition);
|
||||||
|
|
||||||
// Wybuch, gdy Kamikadze dotknie gracza
|
// Wybuch, gdy Kamikadze dotknie gracza
|
||||||
@@ -284,7 +288,7 @@ void Plansza::update() {
|
|||||||
it->explode(playerPosition, playerHit); // Eksplozja trwa
|
it->explode(playerPosition, playerHit); // Eksplozja trwa
|
||||||
}
|
}
|
||||||
|
|
||||||
// Usunięcie martwego Kamikadze z listy
|
// Usunięcie martwego Kamikadze
|
||||||
if (it->isAlive()) {
|
if (it->isAlive()) {
|
||||||
window->draw(it->getSprite());
|
window->draw(it->getSprite());
|
||||||
++it;
|
++it;
|
||||||
@@ -361,6 +365,64 @@ void Plansza::update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto& bomberEnemy : BEnemies) {
|
||||||
|
for (auto it = bomberEnemy.getBullets().begin(); it != bomberEnemy.getBullets().end();) {
|
||||||
|
bool bulletDestroyed = false;
|
||||||
|
|
||||||
|
// Kolizja pocisku gracza z pociskiem Bombera
|
||||||
|
for (auto playerBulletIt = ship.getBullets().begin(); playerBulletIt != ship.getBullets().end();) {
|
||||||
|
if (playerBulletIt->getSprite().getGlobalBounds().intersects(it->getSprite().getGlobalBounds())) {
|
||||||
|
// Usuń pocisk Bombera i pocisk gracza
|
||||||
|
it = bomberEnemy.getBullets().erase(it);
|
||||||
|
playerBulletIt = ship.getBullets().erase(playerBulletIt);
|
||||||
|
bulletDestroyed = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
++playerBulletIt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kolizja rakiety gracza z pociskiem Bombera
|
||||||
|
if (!bulletDestroyed) {
|
||||||
|
for (auto rocketIt = ship.getRockets().begin(); rocketIt != ship.getRockets().end();) {
|
||||||
|
if (rocketIt->getSprite().getGlobalBounds().intersects(it->getSprite().getGlobalBounds())) {
|
||||||
|
// Usuń pocisk Bombera i rakietę gracza
|
||||||
|
it = bomberEnemy.getBullets().erase(it);
|
||||||
|
rocketIt = ship.getRockets().erase(rocketIt);
|
||||||
|
bulletDestroyed = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
++rocketIt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jeśli pocisk Bombera przetrwał dotychczasowe sprawdzenia, wykonaj inne działania
|
||||||
|
if (!bulletDestroyed) {
|
||||||
|
if (ship.getSprite().getGlobalBounds().intersects(it->getSprite().getGlobalBounds())) {
|
||||||
|
// Kolizja pocisku Bombera z graczem
|
||||||
|
ship.takeDamage();
|
||||||
|
it = bomberEnemy.getBullets().erase(it);
|
||||||
|
} else {
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& wiazkowiec : WEnemies) {
|
||||||
|
wiazkowiec.update();
|
||||||
|
|
||||||
|
if (wiazkowiec.isShooting() && wiazkowiec.getBeam().isVisible()) {
|
||||||
|
if (ship.getSprite().getGlobalBounds().intersects(wiazkowiec.getBeam().getBounds())) {
|
||||||
|
ship.takeDamage(); // Gracz otrzymuje obrażenia
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window->draw(wiazkowiec.getSprite());
|
||||||
|
wiazkowiec.render(*window);
|
||||||
|
}
|
||||||
|
|
||||||
// Usuwanie pocisków, które są poza ekranem srednio to dziala
|
// Usuwanie pocisków, które są poza ekranem srednio to dziala
|
||||||
for (auto enemyIt = enemies.begin(); enemyIt != enemies.end(); ) {
|
for (auto enemyIt = enemies.begin(); enemyIt != enemies.end(); ) {
|
||||||
for (auto bulletIt = enemyIt->getBullets().begin(); bulletIt != enemyIt->getBullets().end();) {
|
for (auto bulletIt = enemyIt->getBullets().begin(); bulletIt != enemyIt->getBullets().end();) {
|
||||||
@@ -451,6 +513,25 @@ void Plansza::update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto wiazkowiecIt = WEnemies.begin(); wiazkowiecIt != WEnemies.end();) {
|
||||||
|
bool hit = false;
|
||||||
|
for (auto bulletIt = ship.getBullets().begin(); bulletIt != ship.getBullets().end();) {
|
||||||
|
if (wiazkowiecIt->getSprite().getGlobalBounds().intersects(bulletIt->getSprite().getGlobalBounds())) {
|
||||||
|
bulletIt = ship.getBullets().erase(bulletIt);
|
||||||
|
wiazkowiecIt->takeDamage();
|
||||||
|
hit = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
++bulletIt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hit && !wiazkowiecIt->isAlive()) {
|
||||||
|
wiazkowiecIt = WEnemies.erase(wiazkowiecIt); // Usunięcie przeciwnika Wiazkowiec
|
||||||
|
} else {
|
||||||
|
++wiazkowiecIt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//oblsuga dla rakiety
|
//oblsuga dla rakiety
|
||||||
@@ -530,6 +611,25 @@ void Plansza::update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto wiazkowiecIt = WEnemies.begin(); wiazkowiecIt != WEnemies.end();) {
|
||||||
|
bool hit = false;
|
||||||
|
for (auto rocketIt = ship.getRockets().begin(); rocketIt != ship.getRockets().end();) {
|
||||||
|
if (wiazkowiecIt->getSprite().getGlobalBounds().intersects(rocketIt->getSprite().getGlobalBounds())) {
|
||||||
|
rocketIt = ship.getRockets().erase(rocketIt);
|
||||||
|
wiazkowiecIt->takeDamage();
|
||||||
|
hit = true;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
++rocketIt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hit && !wiazkowiecIt->isAlive()) {
|
||||||
|
wiazkowiecIt = WEnemies.erase(wiazkowiecIt);
|
||||||
|
} else {
|
||||||
|
++wiazkowiecIt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,14 +679,16 @@ void Plansza::spawn_advanced_enemy() {
|
|||||||
void Plansza::spawn_bomber() {
|
void Plansza::spawn_bomber() {
|
||||||
if (BomberSpawnClock.getElapsedTime().asSeconds() >= 10) { // Spawn co 10 sekund
|
if (BomberSpawnClock.getElapsedTime().asSeconds() >= 10) { // Spawn co 10 sekund
|
||||||
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
||||||
BEnemies.emplace_back(spawnX, -50, BomberEnemyTexture, BombaTexture);
|
Bomber bomber(spawnX, -50, BomberEnemyTexture, BombaTexture);
|
||||||
|
bomber.setPlanszaHeight(size.height, size.width); // Przekazanie wysokości i szerokości okna
|
||||||
|
BEnemies.push_back(bomber);
|
||||||
std::cout << "Spawned Bomber Enemy at X: " << spawnX << std::endl;
|
std::cout << "Spawned Bomber Enemy at X: " << spawnX << std::endl;
|
||||||
BomberSpawnClock.restart();
|
BomberSpawnClock.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plansza::spawn_kamikadze() {
|
void Plansza::spawn_kamikadze() {
|
||||||
if (KamikadzeSpawnClock.getElapsedTime().asSeconds() >= 50) { // Spawn co 10 sekund
|
if (KamikadzeSpawnClock.getElapsedTime().asSeconds() >= 220) { // Spawn co 10 sekund
|
||||||
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
||||||
KEnemies.emplace_back(spawnX, -50, KamikadzeTexture);
|
KEnemies.emplace_back(spawnX, -50, KamikadzeTexture);
|
||||||
std::cout << "Spawned Kamikadze Enemy at X: " << spawnX << std::endl;
|
std::cout << "Spawned Kamikadze Enemy at X: " << spawnX << std::endl;
|
||||||
@@ -594,6 +696,16 @@ void Plansza::spawn_kamikadze() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plansza::spawn_wiazkowiec() {
|
||||||
|
if (WiazkowiecSpawnClock.getElapsedTime().asSeconds() >= 110) { // Spawn co 10 sekund
|
||||||
|
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
||||||
|
Wiazkowiec wiazkowiec(spawnX, -50, WiazkowiecTexture);
|
||||||
|
wiazkowiec.setPlanszaHeight(size.height, size.width); // Przekazanie wysokości i szerokosci okna
|
||||||
|
WEnemies.push_back(wiazkowiec);
|
||||||
|
std::cout << "Spawned Wiazkowiec Enemy at X: " << spawnX << std::endl;
|
||||||
|
WiazkowiecSpawnClock.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,17 +34,40 @@ void Player::alternate_shoot() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::takeDamage() {
|
void Player::update() {
|
||||||
if (health > 0) {
|
// Wyłącz nieśmiertelność po określonym czasie
|
||||||
health--;
|
if (isImmortal && immortalityClock.getElapsedTime().asSeconds() >= immortalityDuration) {
|
||||||
std::cout << "Player hit! Remaining health: " << health << "\n";
|
isImmortal = false;
|
||||||
|
std::cout << "Immortality ended.\n";
|
||||||
|
|
||||||
if (health <= 0) {
|
|
||||||
std::cout << "Player has been destroyed!\n";
|
|
||||||
std::cout << "You lost the game!\n";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Efekt migania podczas nieśmiertelności
|
||||||
|
if (isImmortal) {
|
||||||
|
if (static_cast<int>(immortalityClock.getElapsedTime().asMilliseconds() / 200) % 2 == 0) {
|
||||||
|
actorSprite.setColor(sf::Color(255, 255, 255, 128)); // Półprzezroczysty
|
||||||
|
} else {
|
||||||
|
actorSprite.setColor(sf::Color(255, 255, 255, 255)); // Normalny
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
actorSprite.setColor(sf::Color(255, 255, 255, 255)); // Normalny
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::takeDamage() {
|
||||||
|
if (!isImmortal) {
|
||||||
|
if (health > 0) {
|
||||||
|
health--;
|
||||||
|
std::cout << "Player hit! Remaining health: " << health << "\n";
|
||||||
|
isImmortal = true; // Aktywuj chwilową nieśmiertelność
|
||||||
|
immortalityClock.restart();
|
||||||
|
|
||||||
|
|
||||||
|
if (health <= 0) {
|
||||||
|
std::cout << "Player has been destroyed!\n";
|
||||||
|
std::cout << "You lost the game!\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
188
sources/Wiazkowiec.cpp
Normal file
188
sources/Wiazkowiec.cpp
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
#include "../headers/Wiazkowiec.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "../headers/Bullet.h"
|
||||||
|
#include <random>
|
||||||
|
|
||||||
|
Wiazkowiec::Wiazkowiec(int x, int y, const sf::Texture& texture) : Actor(x, y, texture), beam(0, 0, 50.f, 50.f, sf::Color::Red) {
|
||||||
|
actorSprite.setTexture(texture);
|
||||||
|
hp = 2; // 2 punkty życia
|
||||||
|
firerate = 5000; // Strzela co 10
|
||||||
|
moving_speed = 5.0f; // Prędkość
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wiazkowiec::setPlanszaHeight(float height, float width) {
|
||||||
|
planszaHeight = height;
|
||||||
|
planszaWidth = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wiazkowiec::spawnBeam() {
|
||||||
|
float beamX = position.x;
|
||||||
|
float beamY = position.y;
|
||||||
|
float beamWidth = 50.f;
|
||||||
|
float beamHeight = 0.f;
|
||||||
|
|
||||||
|
switch (direction) {
|
||||||
|
case DirectionW::Up:
|
||||||
|
beamHeight = position.y;
|
||||||
|
beamY -= beamHeight;
|
||||||
|
beam = Beam(beamX, beamY, beamWidth, beamHeight, sf::Color::Red);
|
||||||
|
break;
|
||||||
|
case DirectionW::Down:
|
||||||
|
beamHeight = planszaHeight - position.y;
|
||||||
|
beam = Beam(beamX, beamY, beamWidth, beamHeight, sf::Color::Red);
|
||||||
|
break;
|
||||||
|
case DirectionW::Left:
|
||||||
|
beamHeight = 50.f;
|
||||||
|
beamWidth = position.x;
|
||||||
|
beamX -= beamWidth;
|
||||||
|
beamY = position.y + (actorSprite.getGlobalBounds().height / 2) - 25.f;
|
||||||
|
beam = Beam(beamX, beamY, beamWidth, beamHeight, sf::Color::Red);
|
||||||
|
break;
|
||||||
|
case DirectionW::Right:
|
||||||
|
beamHeight = 50.f;
|
||||||
|
beamWidth = 800 - position.x;
|
||||||
|
beamY = position.y + (actorSprite.getGlobalBounds().height / 2) - 25.f;
|
||||||
|
beam = Beam(beamX, beamY, beamWidth, beamHeight, sf::Color::Red);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
beam = Beam(beamX, beamY, beamWidth, beamHeight, sf::Color::Red);
|
||||||
|
beam.setVisible(true);
|
||||||
|
|
||||||
|
shooting = true;
|
||||||
|
shootingClock.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strzał wiązki
|
||||||
|
void Wiazkowiec::shoot() {
|
||||||
|
if (!shooting) {
|
||||||
|
spawnBeam();
|
||||||
|
std::cout << "Wiazkowiec shot a beam!" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wiazkowiec::setRandomDirection() {
|
||||||
|
// Losowanie kierunku: 0 = Up, 1 = Down, 2 = Left, 3 = Right
|
||||||
|
int directionIndex = std::rand() % 4;
|
||||||
|
|
||||||
|
switch (directionIndex) {
|
||||||
|
case 0:
|
||||||
|
direction = DirectionW::Up;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
direction = DirectionW::Down;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
direction = DirectionW::Left;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
direction = DirectionW::Right;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wiazkowiec::updateDirection() {
|
||||||
|
auto spriteBounds = actorSprite.getGlobalBounds(); // Pobierz rozmiar i pozycję sprite'a
|
||||||
|
|
||||||
|
// Kontrola górnej i dolnej krawędzi
|
||||||
|
if (position.y <= 0) {
|
||||||
|
direction = DirectionW::Down;
|
||||||
|
} else if (position.y + spriteBounds.height >= planszaHeight) {
|
||||||
|
direction = DirectionW::Up;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kontrola lewej i prawej krawędzi
|
||||||
|
if (position.x <= 0) {
|
||||||
|
direction = DirectionW::Right;
|
||||||
|
} else if (position.x + spriteBounds.width >= planszaWidth) {
|
||||||
|
direction = DirectionW::Left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Wiazkowiec::move(float deltaX, float deltaY) {
|
||||||
|
auto spriteBounds = actorSprite.getGlobalBounds(); // Rozmiar i pozycja sprite'a
|
||||||
|
|
||||||
|
// Zapobiegaj wyjściu poza poziome granice
|
||||||
|
if (position.x + deltaX < 0) {
|
||||||
|
deltaX = -position.x;
|
||||||
|
} else if (position.x + spriteBounds.width + deltaX > planszaWidth) {
|
||||||
|
deltaX = planszaWidth - (position.x + spriteBounds.width);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zapobiegaj wyjściu poza pionowe granice
|
||||||
|
if (position.y + deltaY < 0) {
|
||||||
|
deltaY = -position.y;
|
||||||
|
} else if (position.y + spriteBounds.height + deltaY > planszaHeight) {
|
||||||
|
deltaY = planszaHeight - (position.y + spriteBounds.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
actorSprite.move(deltaX, deltaY);
|
||||||
|
position.x += static_cast<int>(deltaX);
|
||||||
|
position.y += static_cast<int>(deltaY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wiazkowiec::moveLeft() { move(-moving_speed, 0.0f); }
|
||||||
|
void Wiazkowiec::moveRight() { move(moving_speed, 0.0f); }
|
||||||
|
void Wiazkowiec::moveUp() { move(0.0f, -moving_speed); }
|
||||||
|
void Wiazkowiec::moveDown() { move(0.0f, moving_speed); }
|
||||||
|
|
||||||
|
void Wiazkowiec::update() {
|
||||||
|
if (shooting) {
|
||||||
|
// Kontrola zakończenia strzału
|
||||||
|
if (shootingClock.getElapsedTime().asSeconds() >= beamDuration) {
|
||||||
|
beam.setVisible(false);
|
||||||
|
shooting = false;
|
||||||
|
setRandomDirection(); // Zmień kierunek po strzale
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updateDirection();
|
||||||
|
|
||||||
|
switch (direction) {
|
||||||
|
case DirectionW::Up:
|
||||||
|
moveUp();
|
||||||
|
break;
|
||||||
|
case DirectionW::Down:
|
||||||
|
moveDown();
|
||||||
|
break;
|
||||||
|
case DirectionW::Left:
|
||||||
|
moveLeft();
|
||||||
|
break;
|
||||||
|
case DirectionW::Right:
|
||||||
|
moveRight();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shootClock.getElapsedTime().asSeconds() >= 3.0f) { // Co 3 sekundy
|
||||||
|
shoot();
|
||||||
|
shootClock.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ustawianie widoczności wiązki podczas renderowania
|
||||||
|
void Wiazkowiec::render(sf::RenderWindow& window) {
|
||||||
|
if (beam.isVisible()) {
|
||||||
|
beam.render(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Wiazkowiec::isAlive() const {
|
||||||
|
return alive;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wiazkowiec::takeDamage() {
|
||||||
|
if (--hp <= 0) {
|
||||||
|
alive = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Wiazkowiec::isShooting() const {
|
||||||
|
return shooting;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Beam& Wiazkowiec::getBeam() const {
|
||||||
|
return beam;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user