47 lines
1006 B
C++
47 lines
1006 B
C++
#ifndef KAMIKADZE_H
|
|
#define KAMIKADZE_H
|
|
|
|
#include "Enemy.h"
|
|
#include "Actor.h"
|
|
#include "Player.h"
|
|
enum class DirectionK {
|
|
Up,
|
|
Down,
|
|
Left,
|
|
Right
|
|
};
|
|
|
|
class Kamikadze : public Actor {
|
|
public:
|
|
Kamikadze(int x, int y, const sf::Texture& texture);
|
|
|
|
void move(float deltaX, float deltaY) override;
|
|
void moveLeft() override;
|
|
void moveRight() override;
|
|
void moveUp() override;
|
|
void moveDown() override;
|
|
void setRandomDirection();
|
|
void shoot() override;
|
|
|
|
void update(const sf::Vector2f& playerPosition);
|
|
|
|
bool isAlive() const;
|
|
bool isExploding() const;
|
|
void takeDamage();
|
|
void updateDirection();
|
|
|
|
void followPlayer(const sf::Vector2f &playerPosition);
|
|
|
|
void explode(const sf::Vector2f &playerPosition, bool &playerHit);
|
|
|
|
private:
|
|
bool exploding = false;
|
|
sf::Clock explosionClock;
|
|
sf::Clock shootClock;
|
|
float movementSpeed = 2.0f;
|
|
bool alive = true;
|
|
DirectionK direction = DirectionK::Down;
|
|
};
|
|
|
|
#endif //KAMIKADZE_H
|