-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainscene.h
61 lines (43 loc) · 1.01 KB
/
mainscene.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 MAINSCENE_H
#define MAINSCENE_H
#include <QWidget>
#include <QTimer>
#include "map.h"
#include "heroplane.h"
#include "bullet.h"
#include "enemyplane.h"
#include <ctime>
class MainScene : public QWidget
{
Q_OBJECT
public:
MainScene(QWidget *parent = nullptr);
~MainScene();
//初始化场景
void initScene();
//启动
void playGame();
//更新所有元素的坐标
void updatePosition();
//绘制到屏幕中
void paintEvent(QPaintEvent *);
//飞机移动事件
void keyPressEvent(QKeyEvent* event);
//敌机出厂
void enemyToScene();
//碰撞检测
void collisionDetection();
EnemyPlane m_enemys[ENEMY_NUM]; //敌机数组
int m_recorder; //敌机出场间隔记录
//随机数种子
srand((unsigned int) time(NULL));
//地图对象
Map m_map;
//飞机对象
HeroPlane m_hero;
//定时器
QTimer m_Timer;
//测试子弹 子弹对象
//Bullet temp_Bullet;
};
#endif // MAINSCENE_H