-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.h
More file actions
34 lines (27 loc) · 784 Bytes
/
player.h
File metadata and controls
34 lines (27 loc) · 784 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 PLAYER_H
#define PLAYER_H
#include <QObject>
#include <QGraphicsPixmapItem>
#include <QKeyEvent>
#include "indestructiblewall.h"
#include "destructiblewall.h"
#include "bomb.h"
#include "explosion.h"
// Forward declaration of QGraphicsScene
class QGraphicsScene;
class Player : public QObject, public QGraphicsPixmapItem
{
Q_OBJECT
public:
explicit Player(int playerNumber, int monsterNumber, QGraphicsScene* scene, QGraphicsItem *parent = nullptr);
void keyPressEvent(QKeyEvent *event) override;
void placeBomb();
QString getPlayerName();
signals:
void playerMoved(int newX, int newY, int playerNumber);
void bombPlaced(Bomb* bomb);
private:
void movePlayer(int dx, int dy);
int playerNumber; // Player number
};
#endif // PLAYER_H