Do poprawy centrowanie lasera i strzelanie w lewo i w prawo
This commit is contained in:
@@ -11,8 +11,7 @@
|
||||
class Actor {
|
||||
public:
|
||||
Actor(int x, int y, const sf::Texture& texture);
|
||||
|
||||
|
||||
virtual ~Actor() = default;
|
||||
|
||||
sf::Sprite& getSprite();
|
||||
unsigned int getHP();
|
||||
|
||||
@@ -5,23 +5,11 @@
|
||||
|
||||
class Beam {
|
||||
public:
|
||||
Beam(float x, float y, float width, float height);
|
||||
|
||||
void draw(sf::RenderWindow &window);
|
||||
|
||||
void update();
|
||||
void render(sf::RenderWindow& window);
|
||||
|
||||
sf::FloatRect getBounds() const;
|
||||
|
||||
bool isVisible() const;
|
||||
void setVisible(bool visible);
|
||||
|
||||
Beam() = default;
|
||||
Beam(int x, int y, const sf::Texture &texture);
|
||||
|
||||
sf::Sprite getSprite();
|
||||
private:
|
||||
sf::RectangleShape beamShape;
|
||||
bool visible;
|
||||
sf::Texture beamTexture;
|
||||
sf::Sprite beamSprite;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,4 +6,14 @@ struct Position {
|
||||
int y;
|
||||
};
|
||||
|
||||
struct PositionU {
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
};
|
||||
|
||||
struct PositionF {
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
#endif //LOTOSTATEK_POSITION_H
|
||||
|
||||
@@ -13,40 +13,47 @@ enum class DirectionW {
|
||||
|
||||
class Wiazkowiec : public Actor {
|
||||
public:
|
||||
Wiazkowiec(int x, int y, const sf::Texture& texture);
|
||||
Wiazkowiec(int x, int y, const sf::Texture& texture, sf::RenderWindow *window);
|
||||
|
||||
void shoot() override;
|
||||
void move(float deltaX, float deltaY) override;
|
||||
void moveLeft() override;
|
||||
void moveRight() override;
|
||||
void moveUp() override;
|
||||
void moveDown() override;
|
||||
|
||||
void takeDamage();
|
||||
|
||||
void setRandomDirection();
|
||||
void checkIfBeamShootOutOfBounds();
|
||||
|
||||
void update();
|
||||
|
||||
void shoot() override;
|
||||
void render(sf::RenderWindow &window);
|
||||
|
||||
bool isAlive() const;
|
||||
void takeDamage();
|
||||
void checkIfBeamShootOutOfBounds();
|
||||
bool isShooting() const;
|
||||
const Beam* getBeam() const;
|
||||
void setPlanszaHeight(float height, float width);
|
||||
|
||||
void setPlanszaHeight(int height, int width);
|
||||
Beam* getBeam() const;
|
||||
|
||||
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::Texture beamTexture;
|
||||
sf::Clock shootClock;
|
||||
sf::Clock shootingClock;
|
||||
float beamDuration = 1.0f;
|
||||
DirectionW direction = DirectionW::Down;
|
||||
|
||||
Beam *beam; // wskaźnik na wiązkę
|
||||
sf::RenderWindow *window_ptr;
|
||||
|
||||
void spawnBeam(); // Tworzy wiązkę
|
||||
|
||||
int planszaHeight = 800;
|
||||
int planszaWidth = 600;
|
||||
float beamDuration = 1.0f;
|
||||
float movementSpeed = 2.0f;
|
||||
bool shooting = false;
|
||||
bool alive = true;
|
||||
};
|
||||
|
||||
#endif //WIAZKOWIEC_H
|
||||
|
||||
Reference in New Issue
Block a user