wiazkowiec strzela, gora dol

This commit is contained in:
2024-12-11 23:00:07 +01:00
parent b257837d18
commit c898aa0d81
8 changed files with 352 additions and 6 deletions

51
headers/Wiazkowiec.h Normal file
View File

@@ -0,0 +1,51 @@
#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;
private:
sf::Clock shootClock;
sf::Texture WiazkaTexture;
float movementSpeed = 2.0f;
bool alive = true;
DirectionW direction = DirectionW::Down;
Beam beam; // Wiązka
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)
void spawnBeam(); // Tworzy wiązkę
};
#endif //WIAZKOWIEC_H