-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.h
53 lines (40 loc) · 1.2 KB
/
player.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
#pragma once
#include <QObject>
#include <QMouseEvent>
#include <QGraphicsPixmapItem>
#include "rocketFlame.h"
class Player: public QObject, public QGraphicsPixmapItem
{
Q_OBJECT
bool leftKeyPressed = false;
bool rightKeyPressed = false;
bool upKeyPressed = false;
bool downKeyPressed = false;
bool toggleKeyPressed = false;
bool leftMousePressed = false;
bool rightMousePressed = false;
int rocketState = 1;
bool outOfEnergy = false;
//Control definitions
Qt::Key upKey = Qt::Key_W;
Qt::Key leftKey = Qt::Key_A;
Qt::Key downKey = Qt::Key_S;
Qt::Key rightKey = Qt::Key_D;
Qt::Key toggleKey = Qt::Key_Space;
double speed = 0;
const int rocketFlameX = -102;
const int rocketFlameY = 30;
const int turboShakeAmount = 7;
public:
const int shipHeight = 99;
const int shipWidth = 245;
Player();
RocketFlame * rocketFlame = new RocketFlame(100, 100);
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
//void mousePressEvent(QMouseEvent *event);
//void mouseReleaseEvent(QMouseEvent *event);
//void mouseMoveEvent(QMouseEvent *event);
public slots:
void handleInput();
};