5 przeciwnikow, jakos to dziala
This commit is contained in:
@@ -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
|
||||
@@ -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)
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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ę
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user