-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunit.h
40 lines (33 loc) · 796 Bytes
/
unit.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
#ifndef UNIT_H
#define UNIT_H
#include <QObject>
#include <QGraphicsItem>
#include <QRectF>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QWidget>
#include <QTimer>
#include <QDebug>
class Unit : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
explicit Unit(int x, int y, int atk, int def, int hp, QString name, QObject *parent = nullptr);
void modifyHp(int val);
int getHp();
int getx();
int gety();
protected:
QRectF boundingRect()const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
signals:
public slots:
virtual void advance();
protected:
int x, y, maxhp, atk, def, hp;
QImage image, image_battle;
int imageNo;
bool battle;
int time_cnt;
};
#endif // UNIT_H