-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenemy.h
More file actions
45 lines (35 loc) · 852 Bytes
/
enemy.h
File metadata and controls
45 lines (35 loc) · 852 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
35
36
37
38
39
40
41
42
43
44
45
#ifndef ENEMY_H
#define ENEMY_H
#include <QObject>
#include <QPoint>
#include <QSize>
#include <QPixmap>
#include <QColor>
class WayPoint;
class QPainter;
class Window1;
class Plant;
class Enemy : public QObject
{
Q_OBJECT
public:
Enemy(WayPoint *startWayPoint, Window1 *game, const QPixmap &sprite = QPixmap(":/enemy.gif"));
void draw(QPainter *painter) const;
void move();
QPoint pos() const;
public slots:
void doActivate();
private:
bool m_active;//判断是否可以移动
int m_maxHp;
int m_currentHp;
qreal m_walkingSpeed;
qreal m_rotationSprite;
QPoint m_pos;
WayPoint * m_destinationWayPoint;//储存当前航点
Window1 * m_game;
QList<Plant *> m_attackedTowersList;
const QPixmap m_sprite;
static const QSize ms_fixedSize;
};
#endif // ENEMY_H