54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
#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);
|
|
void setMapBounds(float width, float height);
|
|
|
|
|
|
private:
|
|
float planszaHeight = 800.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
|