Skip to content
GitLab
菜单
项目
群组
代码片段
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录/注册
切换导航
菜单
打开侧边栏
Jiahan Cao
Aircraft-Battle
提交
cb083ac0
提交
cb083ac0
编辑于
6月 03, 2019
作者:
CjhGm
浏览文件
reconstruct
上级
a9486dba
变更
2
Hide whitespace changes
Inline
Side-by-side
AircraftBattle/PlaneWar/AircraftBattleView.cpp
浏览文件 @
cb083ac0
...
@@ -402,27 +402,26 @@ void CAircraftBattleView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
...
@@ -402,27 +402,26 @@ void CAircraftBattleView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
else
if
(
!
isOver
)
{
else
if
(
!
isOver
)
{
if
(
myplane
!=
NULL
&&
GetKeyState
(
VK_SPACE
)
<
0
)
{
if
(
myplane
!=
NULL
&&
GetKeyState
(
VK_SPACE
)
<
0
)
{
// 按空格键发射子弹
// 按空格键发射子弹
CBullet
*
bullet1
,
*
bullet2
,
*
bullet3
;
CBullet
*
bullet1
,
*
bullet2
,
*
bullet3
;
bullet1
=
bullet2
=
bullet3
=
nullptr
;
bullet1
=
bullet2
=
bullet3
=
nullptr
;
switch
(
myScore
/
100
)
{
if
(
myScore
<
100
)
{
case
0
:
bullet1
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
0
,
30
,
true
);
bullet1
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
0
,
30
,
true
);
bulletList
.
AddTail
(
bullet1
);
bulletList
.
AddTail
(
bullet1
);
break
;
}
case
1
:
bullet1
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
-
10
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
0
,
30
,
true
);
else
if
(
myScore
<
300
)
{
bullet2
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
+
10
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
0
,
30
,
true
);
bullet1
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
-
15
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
0
,
30
,
true
);
bulletList
.
AddTail
(
bullet1
);
bullet2
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
+
15
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
0
,
30
,
true
);
bulletList
.
AddTail
(
bullet2
);
bulletList
.
AddTail
(
bullet1
);
break
;
bulletList
.
AddTail
(
bullet2
);
default:
bullet1
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
0
,
30
,
true
);
}
bullet2
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
-
5
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
10
,
30
,
true
);
else
{
bullet3
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
+
5
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
-
10
,
30
,
true
);
bullet1
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
0
,
30
,
true
);
bulletList
.
AddTail
(
bullet1
);
bullet2
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
-
10
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
10
,
30
,
true
);
bulletList
.
AddTail
(
bullet2
);
bullet3
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
+
10
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
-
10
,
30
,
true
);
bulletList
.
AddTail
(
bullet3
);
bulletList
.
AddTail
(
bullet1
);
break
;
bulletList
.
AddTail
(
bullet2
);
bulletList
.
AddTail
(
bullet3
);
}
}
CBullet
*
bullet
=
new
CBullet
(
myplane
->
GetPoint
().
x
+
PLANE_WIDTH
/
2
-
BULLET_WIDTH
/
2
,
myplane
->
GetPoint
().
y
,
myplane
->
getDamage
(),
0
,
30
,
true
);
bulletList
.
AddTail
(
bullet
);
}
}
}
}
else
{
else
{
...
...
AircraftBattle/PlaneWar/CEnemy.h
浏览文件 @
cb083ac0
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#define ENEMY_HEIGHT 90 // 敌机的高度
#define ENEMY_HEIGHT 90 // 敌机的高度
#define ENEMY_WIDTH 120 // 敌机的宽度
#define ENEMY_WIDTH 120 // 敌机的宽度
#define ENEMY_SPEED 3 // 敌机飞行速度
#define ENEMY_SPEED 3 // 敌机飞行速度
#define ENEMY_HP
1
// 敌机血量
#define ENEMY_HP
2
// 敌机血量
#define ENEMY_DAMAGE 1 // 敌机伤害
#define ENEMY_DAMAGE 1 // 敌机伤害
#define ENEMY_SCORE 10 // 敌机分数
#define ENEMY_SCORE 10 // 敌机分数
...
...
编辑
预览
Supports
Markdown
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录