2Android的手机飞行射击游戏的实现+源代码

本游戏基本实现了安卓端手机飞行射击游戏的基本功能,在传统的操作模式之上加入了传感器元素,关卡多样并且游戏元素充足,界面精良,能够满足玩家对于手机端小游戏的基本要求。


摘要:现代生活中,人们忙于工作学习,生活节奏极快,压力较大,手机小游戏就成为了他们休闲放松的一种重要方式,手机游戏的开发随之也变得愈加热门。结合此现状,笔者设计出了一款基于Android操作系统的手机飞行射击游戏APP。本款游戏利用JAVA语言在Eclipse环境下完成开发,利用Android自带的SQLITE数据库实现玩家信息的注册和分数统计,可以及时生成游戏排行榜。采用双缓冲绘图的方式以及SurfaceView组件完成游戏界面的绘画和更新,通过Activity组件实现不同界面之间的切换,利用触屏识别对飞机进行控制。此外,本系统在传统飞机游戏的基础上增加了商店界面和体感操作,利用姿态传感器进行飞机操控,增加了游戏的多样性和可玩性。本款游戏在Android模拟器和真机上测试通过,界面美观丰富,操作方便。

关键词:Android游戏开发;Activity组件;SurfaceView视图;姿态传感器

Mobile shooting game implementation based on the Android

Abstract:In modern life, people have been busy with work and study with fast life pace and great life pressure. Therefore,mobile games have become an important way to relax themselves, the development of mobile games has become increasingly popular at the same time. Combining with such situation, the author designed a mobile shooting game APP based on Android operating system. This game is finished in Eclipse using JAVA language, it uses Android self-contained SQLITE database to finish the registration of players’information and score statistics to generate rankings in time. the painting and updating of game interface is realized by the double buffered drawing and Surfaceview components. And it is through the Activity for the switching of different interface. Players will use the touch screen recognition technology to control the virtual aircraft. Besides, on the basis of the traditional mobile airplane games, the system adds the interface of shop in game and somatosensory operation. People could control their aircraft by using the attitude transducer which will increase the persity and playability of the game. The game has passed test in Android SDK and prototype of mobile phone comes with a beautiful interface and it is convenient in operation.

Key words: Android game developer; Activity; Surfaceview; Attitude transducer

目  录

摘要 1

关键词 1

ABSTRACT 1

KEY WORDS 1

引言 1

1 绪论 2

1.1 选题背景 2

1.2 国内外研究状况 2

1.3 研究内容 2

1.4 论文组织结构 3

2 关键开发技术 3

2.1 ACTIVITY组件 3

2.2 SURFACEVIEW视图 3

2.3 双缓冲机制 3

2.4 姿态传感器 3

3 游戏系统分析 3

3.1 可行性分析 3

3.1.1 社会环境可行性分析 4

3.1.2 经济可行性分析 4

3.1.3 技术可行性分析 4

3.2 功能需求分析 4

3.3 用例分析 4

3.4 游戏进程介绍 6

3.5 运行环境 6

4 系统总体设计 6

4.1 系统软件结构 6

4.2 文件组织结构 7

4.3 数据库设计 9

4.4 ACTIVITY类的设计 9

4.4.1 MainActivity:程序主界面 9

4.4.2 chooseActivity:模式选择界面 10

4.4.3 LoginActivity:闯关模式登录界面 10

4.4.4 MainGameActivity:游戏主界面 10

4.4.5 xuanzeActivity:选关界面 11

4.4.6 辅助Activity类 11

4.5 游戏主体元素类的设计 11

4.5.1 游戏背景设计 11

4.5.2 飞机类设计 12

4.5.3 敌机类设计 12

4.5.4 清屏类设计 13

4.5.5 子弹类设计 13

4.5.6 敌弹类设计 13

4.5.7 药瓶类设计 13

4.5.8 血条类设计 14

4.5.9 炮台类设计 14

4.5.10 炮弹类设计 14

4.5.11 弹药包类设计 14

4.5.12 SurfaceView的设计 14

5  系统功能实现 15

5.1 ACTIVITY的实现 15

5.1.1 游戏主界面MainActivity的实现 15