-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotagonist.h
47 lines (38 loc) · 1.01 KB
/
protagonist.h
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
46
47
#ifndef PROTAGONIST_H
#define PROTAGONIST_H
#include "entity.h"
#include "sword.h"
#include <QGraphicsObject>
#include <QObject>
#include <QPixmap>
#include <QSet>
class Protagonist : public Entity {
Q_OBJECT
friend class GameControl;
public:
Protagonist();
QRectF boundingRect() const override;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
QWidget* widget = nullptr) override;
QPainterPath shape() const override;
void advance(int phase) override;
protected:
void keyPressEvent(QKeyEvent* event) override;
void keyReleaseEvent(QKeyEvent* event) override;
private:
QPixmap pic_normal, pic_walk1, pic_walk2;
bool walk_phase = true;
QSet<int> state;
int blood = 100;
int attackBlood = 100;
bool hurt = false;
Sword sword;
private slots:
void setShowShape(bool show);
signals:
void attack();
/*things have not been realised*/
// void currentPos(QPointF);
// void gameOver();
};
#endif // PROTAGONIST_H