5 przeciwnikow, jakos to dziala

This commit is contained in:
2024-12-11 23:47:20 +01:00
parent 1c0e5d0293
commit 38fd71b8e6
8 changed files with 158 additions and 42 deletions

View File

@@ -8,6 +8,8 @@ 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);
@@ -20,6 +22,8 @@ public:
private:
sf::RectangleShape beamShape;
bool visible;
sf::Texture beamTexture;
sf::Sprite beamSprite;
};
#endif // LOTOSTATEK_BEAM_H

View File

@@ -3,6 +3,8 @@
#include <chrono>
#include <SFML/System/Clock.hpp>
#include "Actor.h"
#include "Rocket.h"
@@ -20,6 +22,7 @@ public:
void moveDown() override;
void takeDamage();
bool isAlive() const;
void update();
std::vector<Rocket>& getRockets();
private:
std::chrono::steady_clock::time_point lastShotTime = std::chrono::steady_clock::now();
@@ -27,6 +30,9 @@ private:
sf::Texture rocketTexture;
int health = 3; // Liczba punktów życia gracza
sf::Texture bulletTexture;
bool isImmortal = false; // Czy gracz jest chwilowo nietykalny
sf::Clock immortalityClock; // Zegar kontrolujący czas nieśmiertelności
float immortalityDuration = 1.5f; // Czas trwania nieśmiertelności (w sekundach)
};

View File

@@ -32,9 +32,12 @@ public:
void updateDirection();
bool isShooting() const;
const Beam& getBeam() const;
void setPlanszaHeight(float height);
void setMapBounds(float width, float height);
private:
float planszaHeight = 800.f;
sf::Clock shootClock;
sf::Texture WiazkaTexture;
float movementSpeed = 2.0f;
@@ -44,7 +47,8 @@ private:
bool shooting = false; // Czy obecnie strzela
sf::Clock shootingClock; // Zegar kontrolujący czas strzału
float beamDuration = 1.0f; // Czas trwania widoczności wiązki (w sekundach)
float mapWidth; // Szerokość mapy/planszy
float mapHeight;
void spawnBeam(); // Tworzy wiązkę
};