-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfield.h
61 lines (50 loc) · 1.39 KB
/
field.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef FIELD_H
#define FIELD_H
#include <QGraphicsPixmapItem>
#include <QObject>
#include "destroyableblock.h"
#include "undestroyableblock.h"
#include "explosion.h"
#include "bomb.h"
#include "settings.h"
#include "healthpowerup.h"
#include "bombpowerup.h"
#include "explosionpowerup.h"
enum blockType {
Destroyable,
Undestroyable,
Empty
};
class Player;
class Field : public QObject, public QGraphicsPixmapItem {
Q_OBJECT
public:
Field(int x, int y, QObject *parent = nullptr);
~Field();
blockType isBlockOnField() const;
void setUnDestroyableBlock(UnDestroyableBlock * unDestroyableBlock);
void setDestoryableBlock(DestroyableBlock * destroyableBlock);
void setBomb(Bomb * bomb);
void playerOn(Player * player);
void playerOut(Player * player);
void getPowerUp(Player * player);
bool isBomb() const;
bool isUnDestroyableBlock() const;
bool isClear() const;
public slots:
void explosion();
private:
void createPixmapItem(QGraphicsPixmapItem *item, QString path) const;
void createExplosion();
void randPowerUp();
int _x;
int _y;
bool _isPlayerOn;
DestroyableBlock * _destroyableBlock = nullptr;
UnDestroyableBlock * _unDestroyableBlock = nullptr;
Explosion * _explosion = nullptr;
Bomb * _bomb = nullptr;
Player * _players[sizes::Players];
PowerUp * _powerUp = nullptr;
};
#endif // FIELD_H