-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathEnemy.h
More file actions
34 lines (27 loc) · 666 Bytes
/
Enemy.h
File metadata and controls
34 lines (27 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef ENEMY_H
#define ENEMY_H
#include <QGraphicsRectItem>
#include <vector>
#include <QPointF>
class Enemy:public QObject, public QGraphicsRectItem{
Q_OBJECT
public:
// constructors
Enemy( int stepSize, QGraphicsItem* parent=nullptr);
// modifiers ("setters")
void setPoints(const std::vector<QPointF>& points);
public slots:
// slots (modifier)
void move();
private:
// main private attributes
std::vector<QPointF> points_;
size_t targetPoint_;
int stepSize_;
// helper functions
bool targetReached();
bool atLastPoint();
void setNextTarget();
void moveTowardsTarget();
};
#endif // ENEMY_H