-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.h
84 lines (75 loc) · 1.72 KB
/
game.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef GAME_H
#define GAME_H
#include "ball.h"
#include "brick.h"
#include "paddle.h"
#include "bullet.h"
#include "basicenemy.h"
#include "diagenemy.h"
#include "trackerenemy.h"
#include "drop.h"
#include "shielddrop.h"
#include "oneupdrop.h"
#include "moneydrop.h"
#include "floaters.h"
#include "spacemine.h"
#include "debris.h"
#include "bossenemy.h"
#include "slowdrop.h"
#include <QWidget>
#include <QKeyEvent>
#include <QVector>
class Game : public QWidget
{
Q_OBJECT
public:
Game(QWidget *parent = 0);
~Game();
protected:
void paintEvent(QPaintEvent *event);
void timerEvent(QTimerEvent *event);
void keyPressEvent(QKeyEvent *event);
void playerShoot();
void victory();
void checkCollision();
void enemyDrop(int, int);
void spawnFloaters();
void changeScore(int);
int getScore();
void changeLives(int);
int getLives();
void lowerShields();
void spawnEnemies();
private:
int x;
int timerId;
Ball *ball;
Paddle *paddle;
//Brick * bricks[30];
//QVector<Brick> enemyVec;
//Brick * enemyVec[12];
QVector<Brick*> enemyVec;
QVector<Bullet> bulletVec;
QVector<Bullet> enemyBulletVec;
QVector<Drop*> dropVec;
QVector<Floaters*> floaterVec;
bool gameOver;
bool gameWon;
bool gameStarted;
bool paused;
int level;
int lives;
int score;
int shield;
bool finishedGame;
public slots:
void startGame();
void pauseGame();
void stopGame();
signals:
void scoreChanged(int score);
void levelChanged(int level);
void livesChanged(int lives);
void shieldChanged(int shield);
};
#endif // GAME_H