40 lines
731 B
C++
40 lines
731 B
C++
#ifndef ENEMY_H
|
|
#define ENEMY_H
|
|
|
|
#include "Actor.h"
|
|
#include "SFML/System/Clock.hpp"
|
|
|
|
enum class Direction {
|
|
Up,
|
|
Down,
|
|
Left,
|
|
Right
|
|
};
|
|
|
|
class Enemy : public Actor {
|
|
public:
|
|
Enemy(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 update();
|
|
|
|
bool isAlive() const;
|
|
void takeDamage();
|
|
void updateDirection();
|
|
|
|
private:
|
|
sf::Clock shootClock;
|
|
sf::Texture enemyBulletTexture;
|
|
float movementSpeed = 2.0f;
|
|
bool alive = true;
|
|
Direction direction = Direction::Down;
|
|
};
|
|
|
|
#endif // ENEMY_H
|