基于Java的飞机大战游戏的设计与实现论文
用Java实现一个简单的打飞机游戏

用Java实现一个简单的打飞机游戏打飞机游戏是一类经典的游戏,具有简单、刺激和容易上手的特点。
在本文中,我们将使用Java编程语言来实现一个简单的打飞机游戏。
要实现这个游戏,我们可以分为三个主要的步骤:游戏初始化、游戏逻辑和游戏界面。
第一步是游戏初始化。
我们需要设置游戏窗口的大小和标题,以及创建游戏界面所需的元素,如玩家飞机、敌机和子弹。
我们可以使用Java提供的图形库,如AWT或JavaFX来创建游戏窗口和界面元素。
第二步是游戏逻辑。
我们需要定义游戏的规则和行为。
首先,我们需要让玩家飞机可以根据用户的输入(如键盘按键)进行移动。
然后,我们需要创建敌机,并使其在游戏界面上自动移动。
接下来,我们需要创建子弹,并使其可以击中敌机。
当玩家的飞机与敌机相撞或者子弹击中敌机时,游戏将结束。
最后一步是游戏界面。
我们需要定义游戏界面的显示方式。
可以在游戏界面上显示玩家的飞机和敌机,并实时更新它们的位置。
还可以显示分数和游戏状态,以提供更好的游戏体验。
下面是一个简单的示例代码,演示了如何使用Java实现一个简单的打飞机游戏:```javaimport javax.swing.*;import java.awt.*;import java.awt.event.KeyEvent;import java.awt.event.KeyListener;public class SimplePlaneGame extends JFrame implements KeyListener {private final int WINDOW_WIDTH = 800;private final int WINDOW_HEIGHT = 600;private int playerX = 400;private int playerY = 500;private boolean gameRunning = true;public SimplePlaneGame() {setTitle("Simple Plane Game");setSize(WINDOW_WIDTH, WINDOW_HEIGHT);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setResizable(false);setLocationRelativeTo(null);setLayout(null);setVisible(true);addKeyListener(this);}public void paint(Graphics g) {super.paint(g);g.setColor(Color.BLUE);g.fillRect(playerX, playerY, 50, 50);}public void keyPressed(KeyEvent e) {if (e.getKeyCode() == KeyEvent.VK_LEFT) {playerX -= 5;repaint();} else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { playerX += 5;repaint();}}public void keyReleased(KeyEvent e) {}public void keyTyped(KeyEvent e) {}public static void main(String[] args) {SimplePlaneGame game = new SimplePlaneGame();while (game.gameRunning) {try {Thread.sleep(10);} catch (InterruptedException e) {e.printStackTrace();}}}}```在这个示例中,我们使用了一个继承自JFrame的类来创建游戏窗口。
(完整版)飞机大战--毕业论文--初稿

(完整版)飞机大战--毕业论文--初稿毕业设计(论文)题目:基于安卓平台的飞机大战游戏学院:计算机科学学院专业班级:计算机科学与技术10级2班指导教师:黄国兵职称:高级工程师学生姓名:赵兵摘要自从第一台计算机研发以来,计算机行业得到了迅速的发展,成就了很多优秀的企业,例如国外的IBM,微软,GOOGLE,ARM,苹果等,国内的腾讯,阿里巴巴,百度等,而引领计算机行业的主要因素除了硬件的支撑外,就数操作系统了,而操作系统从Dos,UNIX,LINUX Windows等PC端正在逐渐向移动端转变如:从Linux到Android;从Unix到IOS;从Windows到Windows phone,主要还是因为移动端的便携性,轻巧性深受人们的喜爱,就在这样的移动互联网浪潮中,Android系统更是高达移动端操作系统80%的占有率,真可谓前景无限,而在Android平台的应用中游戏业务又占着最大的比例,所以本次选题为基于Android的飞机大战游戏,其主要目的研究移动互联网的发展趋势,对其未来的发展有深刻清晰的认识。
本论文主要阐述以面向对象的程序开发语言Java及Eclipse为开发工具,而基于智能手机Android系统之上的飞机大战游戏。
首先简要介绍课题的研究背景、目的及意义,Android的发展历程、当前国内外的发展现状。
然后介绍了Android平台开发环境及环境搭建,最后讲述了基于Android飞机大战游戏功能的实现。
其功能模块如下:提供敌机的类模块,提供子弹的类模块,主界面模块,天空背景模块,检测子弹与敌机碰撞模块,检测,敌机与我拥有的战机碰撞木块等,除此以外还为用户提供更加人性化的设计和方便人员的操作流程。
由于Android逐渐成为智能手机技术的主导,相信其基于Android的飞机大战游戏将会受到更大的欢迎。
关键字:安卓,游戏,飞行射击,飞机ABSTRACTSince the first computer researched and development , the computer industry rapid development , that made a lot of excellent enterprise , such as : IBM , Microsoft , Google , ARM , Apple inc In a foreign country ; T encent , Alibaba Group , Baidu In the domestic . Led by the computer industry in addition to factors for operating system . And the operating system from Dos, UNIX, LINUX, Windows PC correct is gradually to mobile terminal such as: LINUX - > Android. Unix - > IOS; Windows - > Windows phone, mostly because the mobile end portability, and was deeply loved by people, in this kind of mobile Internet, in the tide of the Android system is as the application of the Android platform gamebusiness accounts for the largest proportion, so this topic is based on the Android plane war game, the development trend of mobile Internet, the main objective for its future development are clear understanding.This thesis mainly expounds Java with object oriented programming language and Eclipse as the development tool, and the plane based on the intelligent mobile phone Android war games. First briefly introduced the research background, purpose and significance, the development of Android, the current domestic and foreign development present situation.And then introduced the Android platform development environment andthe environment, finally tells the story of the realization of the function of Android plane war games. Its function module isas follows: enemy planes flying in and out of class module, provides the bullet class module, main interface module, the sky background module, detect bullet collision withthe enemy aircraft module, detection, the enemy aircraft crash with my own wood, etc., in addition also provides users with more and convenient operation. Because the Android smartphone technology Android will be more welcome.KEY WORDS: Android, Game,Flight shooter,Airplane目录第1章绪论 (1)1.1 系统研究的背景及意义 (1)1.2 国内外的发展现状 (1)1.3 主要研究的内容 (2)1.4 本文的组织结构 (2)1.5 本章小结 (3)第2章用户需求分析 (4)2.1系统的架构描述 (4)2.2 系友好的用户界面 (5)2.3技术选型 (6)2.4系统的开发环境 (6)2.5 关键技术和工具简介 (7)2.6 本章小节 (8)第3章系统概要设计 (9)3.1 模块的划分 (9)3.1.1 软件模块设计 (9)3.1.2 软件功能模块 (10)3.2 主界面设计 (12)3.3 游戏界面设计 (13)3.4 系统包及其资源规划 (13)3.4.1 系统包管理如下 (13)3.4.2 Sqlite数据库 (14)3.4.3 Runable接口以及与Thread的区别 (16)3.5 本章小结 (20)第4章系统功能的实现 (21)4.1 主界面的功能实现 (21)4.1 游戏界面的功能实现 (26)4.3 子弹类的设计 (39)4.3 敌机类的设计 (40)4.5本章小结 (42)第5章系统测试 (43)5.1 软件测试的概念 (43)5.2 系统的功能和安全测试 (43)5.3 测试总结 (45)第6章总结 (46)致谢 (47)参考文献 (48)第1章绪论1.1 系统研究的背景及意义在手机游戏的早期,大多数开发者都是想要玩转设备、学习技巧和快速攻关的狂热分子。
大学课程设计报告-飞机大战

湖北大学本科课程设计题目Java课程设计——飞机大战姓名学号专业年级指导教师职称2015年12月18日----目录----一.项目介绍-------------------------------- 1二.概要设计2.1资源需求------------------------------ 12.2游戏流程------------------------------ 1三.类设计3.1游戏界面类---------------------------- 23.2飞行物类------------------------------ 23.3敌机类-------------------------------- 23.4蜜蜂类-------------------------------- 33.5玩家飞机类----------------------------- 33.6子弹类-------------------------------- 4四.编码分析4.1游戏界面类---------------------------- 44.2飞行物类------------------------------ 114.3敌机类-------------------------------- 124.4蜜蜂类-------------------------------- 134.5玩家飞机类----------------------------- 134.6子弹类-------------------------------- 15五.游戏测试画面----------------------------- 16六.总结------------------------------------ 18针对Java课程设计,我做了一个小游戏——飞机大战,游戏代码包含到本学期所学的所有知识点。
程序运行后,进入到开始画面,鼠标单击开始游戏。
jv课程设计飞机大战

• public static Image NUMBER_ 1_IMG;
• public static Image NUMBER_2_IMG;
• public static Image NUMBER_3_IMG;
第12页/共19页
第十二页,编辑于星期六:二点四十七分。
• BIG_PLANE_FIGHTING_IMG;
• X_MARK_IMG;
• public static Image BIG_PLANE_HITTED_IMG;
• public static Image NUMBER_ 0_IMG;
• public static Image BIG_PLANE_BADDLY_WOUN DED_IMG;
BIG_PLANE_IMG; • public static Image
BOSS_PLANE_IMG; • public static Image
BOMB_IMG;
• public static Image DOUBLE_LASER_IMG;
• public static Image CAUGHT_BOMB_IMG;
第四页,编辑于星期六:二点四十七分。
功能分析
1. 游戏程序是一项精度要求很高的程序系统,因为其代码利用率很高。 一个实时运行的最终作品,每秒都会运行成千上万行程序,绘图事件、 键盘事件都会以极高的频率在后台等待响应,若有丝毫的差别都将很容 易导致程序在运行不久后可能出现严重错误,甚至死循环。因此,其逻 辑设计应当相当严谨,需将所有可能发生的事件及意外情况考虑在设计 中。
• File file = new File(filePath);
基于Java的飞机大战游戏的设计与实现论文

毕业设计(论文)任务书第1页第2页第3页基于Java的飞机大战游戏的设计与实现摘要现如今,随着智能手机的兴起与普及,加上4G(the 4th Generation mobile communication ,第四代移动通信技术)网络的深入,越来越多的IT行业开始向手机行业转移重心。
而手机行业中游戏方面的利润所占比重较大,并且手机游戏大多数则是由Java语言开发研制的。
所以我想顺应时代发展,用学到的Java知识对游戏进行一次深入的了解与创作。
Java语言在我们大学学习中占了很大的比重,其优点甚多:面向对象,可靠,安全,多平台可移植,高性能,多线程等。
面向对象是相对于c语言的面向过程来说的,在面向对象编程中,我们用Java去新建一个对象,调用其方法就能实现我们的目标,并不需要了解这个对象的方法的具体实现过程;Java的可靠安全特点体现Java不支持指针,禁止第三方访问,杜绝了外部风险。
所以使用Java开发游戏,是一个正确的选择。
大学学习即将结束,在毕业之际,我想用我4年里学习的知识为自己编写一个属于自己的游戏——飞机大战游戏,为我的大学生活画上圆满的句号。
关键词:Java游戏;面向对象;可靠安全;多线程Design And Implementation Of Airplane WargameBased On JavaAbstractNowadays, with the emergence and popularization of smart phones, plus 4 g (the 4 th Generation mobile communication, the fourth Generation mobile communication technology) the development of the Internet, more and more in the IT industry began to shift to the mobile phone industry center of gravity. Aspect of the game of the mobile phone industry profits account for a large proportion, and most mobile game is developed by Java language. So I want to keep up with the development of The Times, use Java knowledge for an in-depth understanding of the game and creation.Java language learning in our universities accounted for a large proportion of its many advantages: Object-oriented, reliable, secure, multi-platform portable, high-performance, multi-threading.Object-oriented process-oriented with respect to the terms of the c language, object-oriented programming, specifically we use Java to create a new object, call its methods will be able to achieve our goal,we do not need to know the object's method of implementation ; reliable safety features reflect Java Java does not support pointers to prohibit third-party access, to eliminate the external risk. Therefore, the use of Java development aircraft war game, is the right choice.University coming to an end, on the occasion of the graduation, I want to use my four years studying knowledge and made themselves a game of their own - Aircraft war game for my college life painting satisfactory conclusion.Keywords:Java game; object oriented; reliable and secure; multi thread目录1 引言 (1)1.1 项目背景 (1)1. 2 国内外研究现状 (3)1.3 项目主要工作 (4)1.4 本文组织结构 (6)2 开发平台与开发技术 (7)2. 1 IntelliJ IDEA简介 (7)2. 2 IntelliJ IDEA与Eclipse 、MyEclipse的比较 (8)2. 3 Java (10)3 可行性研究 (13)3. 1 技术可行性 (13)3. 2 经济可行性 (13)3. 3 操作可行性 (14)3. 4 用户使用可行性 (14)3. 5 法律可行性 (14)4 需求分析 (15)4. 1 系统需求概述 (16)4. 2 功能模块设计 (17)4.2.1 游戏状态控制功能模块 (17)4.2.2 游戏难度的调整模块 (17)4.2.3 游戏界面绘画功能模块 (17)4.2.4 玩家游戏控制功能模块 (17)4. 3 游戏难点分析 (18)4.3.1 绘图美化 (18)4.3.2 多线程技术的实现 (18)4.3.3 防碰撞问题的解决 (18)4.3.4 动画的实现 (18)5 飞机大战功能实现 (19)5.1 模型图 (19)5.2 软件功能模块 (19)5.3 游戏首页的实现 (20)5.3.1 界面实现 (20)5.3.2 流程图 (21)5.3.3 核心代码 (22)5.4 游戏开始模块的实现 (24)5.4.1 界面实现 (24)5.4.2 流程图 (25)5.4.3 核心代码 (25)5.5 发射子弹模块的实现 (27)5.5.1 界面实现 (27)5.5.2 流程图 (28)5.5.3 核心代码 (29)5.6 积分模块的实现 (33)5.6.1 界面的实现 (33)5.6.2 核心代码 (34)5.7 防碰撞逻辑 (37)5.7.1 核心代码 (37)5.8 游戏操作的实现 (39)5.8.1 核心代码 (39)5.9 特殊NPC蜜蜂 (41)6 系统测试 (42)6.1 测试的定义及其重要性 (43)6.1.1 测试的定义 (43)6.1.2 测试的重要性 (44)6.2 测试方法 (46)6.3 测试结果 (50)7 结论 (51)参考文献 (52)致谢 (54)外文文献 (55)中文翻译 (63)1 引言1.1 项目背景90后的我们,童年最开始接触电子游戏是在游戏厅,那时候的飞机大战游戏机前,往往人山人海,绚丽多彩的画面,带感操作让人沉醉不能自拔。
打飞机游戏毕业设计

打飞机游戏毕业设计篇一:JAVA打飞机游戏毕业设计1 绪论1.1 手机软件现状在信息社会中,手机及其他无线设备越来越多的走进普通百姓的工作和生活,随着信息网络化的不断进展,手机及其他无线设备上网络势在必行。
但是传统手机存在以下弊端:1. 传统手机出厂时均由硬件厂商固化程序,程序不能增加、删除,有了错误也不能更新、修改,若要增加新功能必须另换一部手机。
2. 传统手机访问互联网是通过WAP(Wireless Application Protocal),所有网络资源必须接通网络才能在线访问,非常耗时、费用亦很高。
而Java技术在无线应用方面的优势非常明显:1. 应用程序可按需下载,而不是购买由硬件商提供的套件,可升级空间大。
2. Java技术提供了一个类库,它使的应用开发商可以创建更为直觉、丰富的用户界面(GUI);3. Java技术使网络带宽的应用更为有效,因为应用程序可以下载到器件上,并在本地运行,仅仅是在连接到服务器时才会占用网络带宽。
基于以上分析,Java手机将是未来手机的发展方向,是业界的热点。
1.2 J2ME介绍虽然 Java 已经被用到许多企业级软体上,可是其实骨子里面还是非常适合用在嵌入式系统之中。
Java平台演进到Java2后,Java平台分别针对不同领域的需求被分成四个版本,亦即J2EE、J2SE、J2ME以及JavaCard。
其中J2ME定位在消费性电子产品的应用上。
这个版本针对资源有限的电子消费产品的需求精简核心类库,并提供了模块化的架构让不同类型产品能够随时增加支持的能力。
这个版本的应用层面相当广泛,会是未来Java平台发展的重点项目。
J2ME在1999年的JavaOne开发人员大会上初次亮相,它的目标是面向智能无线设备和小型计算机设备的开发人员。
J2ME的一个关键优点是,J2ME与所有支持Java的设备都是兼容的。
支持Java的设备就是任何运行Java虚拟机器的计算机。
Motorola、Nokia等生产厂商都生产支持Java的设备。
基于JAVA的飞机大战游戏的设计与实现计算机毕业设计论文
基于Java的飞机大战游戏的设计与实现摘要飞机大战是电脑游戏发展史中早期最为经典的游戏之一,经常能在掌上游戏机、手机以及电脑上见到这个游戏。
不过,以往常见的飞机大战游戏是二维平面上的,并且大多以黑白的形式出现,当然在电脑上可以看到多种颜色的飞机大战。
Java自面世后就非常流行,发展迅速,对C++语言形成了有力冲击。
Java 技术具有卓越的通用性、高效性、平台移植性和安全性,广泛应用于个人PC、数据中心、游戏控制台、科学超级计算机、移动电话和互联网,同时拥有全球最大的开发者专业社群。
在全球云计算和移动互联网的产业环境下,Java更具备了显著优势和广阔前景。
本游戏是一个基于java的飞机大战游戏,利用Eclipse平台实现经典的飞机大战游戏。
游戏主要涉及了游戏状态控制功能、游戏难度的调整、游戏界面绘画功能、玩家游戏控制功能,最终展示了游戏开发的基本开发过程和设计思路。
关键词:飞机大战;游戏;java;Eclipse平台Design and implementation of airplane wargame based on JavaAbstractLightning is the history of the development of computer games in the early one of the most classic game, often on a handheld game consoles, mobile phone and computer to see this game. However, the previous common lightning game is two-dimensional plane, and mostly in black and white, in the course of the computer can see lightning in color.Since Java is very popular after the launch, the rapid development of the C + + language to form a strong impact. Java technology has excellent versatility, efficiency, platform portability and security, widely used in personal PC, data center, game consoles, scientific supercomputers, cell phones and the Internet, also has the world's largest developer of professional community . In the world of cloud computing and mobile Internet industry environment, Java and more have a significant advantage and broad prospects.This game is a game based on the realization of Java lightning, lightning classic game based on Eclipse platform. The game is mainly involved in the game state control function, the difficulty of the game, the game interface to adjust the drawing function, game player control function, finally shows the basic development process of game development and design ideas.Keywords: lightning; game; Java; Eclipse platform目录摘要 (i)Abstract (ii)1 引言 (1)1.1 项目背景 (1)1.2 国内外研究现状 (1)1.3 项目主要工作 (1)1.4 本文组织结构 (2)2 开发平台与开发技术 (3)2.1 Eclipse (3)2.2 Eclipse平台 (3)2.3 Java (4)2.4 Java语言的特点与优势 (5)2.5 java技术在游戏开发中的应用 (6)2.6 UML (8)3 飞机大战游戏模块设计 (9)3.1 用户需求分析 (9)3.2 可行性分析 (9)3.3 总体设计原则 (10)3.4 功能模块设计 (11)3.4.1 游戏状态控制功能 (11)3.4.2 游戏难度的调整 (11)3.4.3 游戏界面绘画功能 (11)3.4.4 玩家游戏控制功能 (11)3.5 游戏难点分析 (11)4 飞机大战功能实现 (12)4.1 游戏首页的实现 (12)4.1.1 界面实现 (12)4.1.2 流程图 (13)4.1.3 核心代码 (14)4.2 游戏开始模块的实现 (15)4.2.1 界面实现 (15)4.2.2 流程图 (16)4.2.3 核心代码 (17)4.3 发射子弹模块的实现 (18)4.3.1 界面实现 (18)4.3.2 流程图 (19)4.3.3 核心代码 (20)4.4 积分模块的实现 (22)4.4.1 界面的实现 (22)4.4.2 核心代码 (23)4.5 碰撞逻辑 (26)4.5.1 碰撞画面的实现 (26)4.5.2 核心代码 (27)4.6 游戏玩家与BOSS的血条 (28)4.6.1 玩家血条和BOSS血条的实现 (28)4.6.1 核心代码 (29)4.7 游戏操作的实现 (30)4.7.1 核心代码 (30)5 系统测试 (31)5.1 测试的定义及其重要性 (31)5.1.1 测试的定义 (31)5.1.2 测试的重要性 (31)5.2 测试实例的研究与选择 (31)5.3 测试结果 (32)总结和展望 (33)参考文献 (34)致谢 (35)外文原文 (36)中文翻译 (42)1 引言1.1 项目背景90年代的我们,对小时候的一些经典街机游戏肯定是印象深刻,像“飞机大战”、“超级玛丽”、“坦克大战”等,这些游戏伴随了我们童年,怀旧经典,重温这些经典的游戏,我选择“飞机大战”作为设计的项目。
基于JAVA的飞机大战游戏的设计与实现计算机毕业设计论文
基于JAVA的飞机大战游戏的设计与实现计算机毕业设计论文基于Java的飞机大战游戏的设计与实现摘要飞机大战是电脑游戏发展史中早期最为经典的游戏之一,经常能在掌上游戏机、手机以及电脑上见到这个游戏。
不过,以往常见的飞机大战游戏是二维平面上的,并且大多以黑白的形式出现,当然在电脑上可以看到多种颜色的飞机大战。
Java自面世后就非常流行,发展迅速,对C++语言形成了有力冲击。
Java 技术具有卓越的通用性、高效性、平台移植性和安全性,广泛应用于个人PC、数据中心、游戏控制台、科学超级计算机、移动电话和互联网,同时拥有全球最大的开发者专业社群。
在全球云计算和移动互联网的产业环境下,Java更具备了显著优势和广阔前景。
本游戏是一个基于java的飞机大战游戏,利用Eclipse平台实现经典的飞机大战游戏。
游戏主要涉及了游戏状态控制功能、游戏难度的调整、游戏界面绘画功能、玩家游戏控制功能,最终展示了游戏开发的基本开发过程和设计思路。
关键词:飞机大战;游戏;java;Eclipse平台Design and implementation of airplane wargame based on JavaAbstractLightning is the history of the development of computer games in the early one of the most classic game, often on a handheld game consoles, mobile phone and computer to see this game. However, the previous common lightning game is two-dimensional plane, and mostly in black and white, in the course of the computer can see lightning in color.Since Java is very popular after the launch, the rapid development of the C + + language to form a strong impact. Java technology has excellent versatility, efficiency, platformportability and security, widely used in personal PC, data center, game consoles, scientific supercomputers, cell phones and the Internet, also has the world's largest developer of professional community . In the world of cloud computing and mobile Internet industry environment, Java and more have a significant advantage and broad prospects.This game is a game based on the realization of Java lightning, lightning classic game based on Eclipse platform. The game is mainly involved in the game state control function, the difficulty of the game, the game interface to adjust the drawing function, game player control function, finally shows the basic development process of game development and design ideas.Keywords: lightning; game; Java; Eclipse platform目录摘要 (i)Abstract (ii)1 引言 (1)1.1 项目背景 (1)1.2 国内外研究现状 (1)1.3 项目主要工作 (1)1.4 本文组织结构 (2)2 开发平台与开发技术 (3)2.1 Eclipse (3)2.2 Eclipse平台 (3)2.3 Java (4)2.4 Java语言的特点与优势 (5)2.5 java技术在游戏开发中的应用 (6)2.6 UML (8)3 飞机大战游戏模块设计 (9)3.1 用户需求分析 (9)3.2 可行性分析 (9)3.3 总体设计原则 (10)3.4 功能模块设计 (11)3.4.1 游戏状态控制功能 (11)3.4.2 游戏难度的调整 (11)3.4.3 游戏界面绘画功能 (11)3.4.4 玩家游戏控制功能 (11)3.5 游戏难点分析 (11)4 飞机大战功能实现 (12)4.1 游戏首页的实现 (12)4.1.1 界面实现 (12)4.1.2 流程图 (13)4.1.3 核心代码 (14)4.2 游戏开始模块的实现 (15)4.2.1 界面实现 (15)4.2.2 流程图 (16)4.2.3 核心代码 (17)4.3 发射子弹模块的实现 (18)4.3.1 界面实现 (18)4.3.2 流程图 (19)4.3.3 核心代码 (20)4.4 积分模块的实现 (22)4.4.1 界面的实现 (22)4.4.2 核心代码 (23)4.5 碰撞逻辑 (26)4.5.1 碰撞画面的实现 (26)4.5.2 核心代码 (27)4.6 游戏玩家与BOSS的血条 (28)4.6.1 玩家血条和BOSS血条的实现 (28) 4.6.1 核心代码 (29)4.7 游戏操作的实现 (30)4.7.1 核心代码 (30)5 系统测试 (31)5.1 测试的定义及其重要性 (31)5.1.1 测试的定义 (31)5.1.2 测试的重要性 (31)5.2 测试实例的研究与选择 (31)5.3 测试结果 (32)总结和展望 (33)参考文献 (34)致谢 (35)外文原文 (36)中文翻译 (42)1 引言1.1 项目背景90年代的我们,对小时候的一些经典街机游戏肯定是印象深刻,像“飞机大战”、“超级玛丽”、“坦克大战”等,这些游戏伴随了我们童年,怀旧经典,重温这些经典的游戏,我选择“飞机大战”作为设计的项目。
飞机大战--毕业论文--初稿
毕业设计(论文)题目:基于安卓平台的飞机大战游戏学院:计算机科学学院专业班级:计算机科学与技术10级2班指导教师:黄国兵职称:高级工程师学生:兵学号:***********摘要自从第一台计算机研发以来,计算机行业得到了迅速的发展,成就了很多优秀的企业,例如国外的IBM,微软,GOOGLE,ARM,苹果等,国的腾讯,阿里巴巴,百度等,而引领计算机行业的主要因素除了硬件的支撑外,就数操作系统了,而操作系统从Dos,UNIX,LINUX Windows等PC端正在逐渐向移动端转变如:从Linux 到Android;从Unix到IOS;从Windows到Windows phone,主要还是因为移动端的便携性,轻巧性深受人们的喜爱,就在这样的移动互联网浪潮中,Android系统更是高达移动端操作系统80%的占有率,真可谓前景无限,而在Android平台的应用中游戏业务又占着最大的比例,所以本次选题为基于Android的飞机大战游戏,其主要目的研究移动互联网的发展趋势,对其未来的发展有深刻清晰的认识。
本论文主要阐述以面向对象的程序开发语言Java及Eclipse为开发工具,而基于智能手机Android系统之上的飞机大战游戏。
首先简要介绍课题的研究背景、目的及意义,Android的发展历程、当前国外的发展现状。
然后介绍了Android 平台开发环境及环境搭建,最后讲述了基于Android飞机大战游戏功能的实现。
其功能模块如下:提供敌机的类模块,提供子弹的类模块,主界面模块,天空背景模块,检测子弹与敌机碰撞模块,检测,敌机与我拥有的战机碰撞木块等,除此以外还为用户提供更加人性化的设计和方便人员的操作流程。
由于Android 逐渐成为智能手机技术的主导,相信其基于Android的飞机大战游戏将会受到更大的欢迎。
关键字:安卓,游戏,飞行射击,飞机ABSTRACTSince the first computer researched and development , the computer industry has been rapid development , that made a lot of excellent enterprise , such as : IBM , Microsoft , Google , ARM , Apple inc In a foreign country ; Tencent , Alibaba Group , Baidu In the domestic . Led by the computer industry in addition to hardware support, the main factors for operating system . And the operating system from Dos, UNIX, LINUX, Windows PC correct is gradually to mobile terminal such as: LINUX - > Android. Unix - > IOS; Windows - > Windows phone, mostly because the mobile end portability, and was deeply loved by people, in this kind of mobile Internet, in the tide of the Android system is as high as 80% of mobile terminal operating system share, really unlimited prospects, and in the application of the Android platform game business accounts for the largest proportion, so this topic is based on the Android plane war game, the development trend of mobile Internet, the main objective for its future development are clear understanding.This thesis mainly expounds Java with object oriented programming language and Eclipse as the development tool, and the plane based on the intelligent mobile phone Android war games. First briefly introduced the research background, purpose and significance, the development of Android, the current domestic and foreign development present situation. And then introduced the Android platform development environment and the environment, finally tells the story of the realization of the function of Android plane war games. Its function module is as follows: enemy planes flying in and out of class module, provides the bullet class module, main interface module, the sky background module, detect bullet collision with the enemy aircraft module, detection, the enemy aircraft crash with my own wood, etc., in addition also provides users with more humanized design and convenient operation. Because the Android smartphone technology has become the dominant gradually, believe that the planewar game based on Android will be more welcome.KEY WORDS: Android, Game,Flight shooter,Airplane目录第1章绪论 (1)1.1 系统研究的背景及意义 (1)1.2 国外的发展现状 (1)1.3 主要研究的容 (1)1.4 本文的组织结构 (1)1.5 本章小结 (2)第2章用户需求分析 (3)2.1系统的架构描述 (3)2.2 系友好的用户界面 (4)2.3技术选型 (5)2.4系统的开发环境 (5)2.5 关键技术和工具简介 (6)2.6 本章小节 (7)第3章系统概要设计 (8)3.1 模块的划分 (8)3.1.1 软件模块设计 (8)3.1.2 软件功能模块 (9)3.2 主界面设计 (11)3.3 游戏界面设计 (12)3.4 系统包及其资源规划 (12)3.4.1 系统包管理如下 (12)3.4.2 Sqlite数据库 (13)3.4.3 Runable接口以及与Thread的区别 (15)3.5 本章小结 (19)第4章系统功能的实现 (20)4.1 主界面的功能实现 (20)4.1 游戏界面的功能实现 (25)4.3 子弹类的设计 (37)4.3 敌机类的设计 (38)4.5本章小结 (40)第5章系统测试 (41)5.1 软件测试的概念 (41)5.2 系统的功能和安全测试 (41)5.3 测试总结 (43)第6章总结 (44)致 (45)参考文献 (46)第1章绪论1.1 系统研究的背景及意义在手机游戏的早期,大多数开发者都是想要玩转设备、学习技巧和快速攻关的狂热分子。
飞机大战JAVA程序设计报告
飞机⼤战JAVA程序设计报告中国地质⼤学长城学院Java 程序设计题⽬基于Java的打飞机游戏设计与实现系别信息⼯程系专业计算机科学与技术学⽣姓名马辉学号041120101指导教师⽥⽟龙2015 年 6 ⽉18 ⽇基于Java的打飞机游戏设计与实现1、软件运⾏所需要的软硬件环境本系统是以Windows系统为操作平台,⽤Java编程语⾔来实现本系统所需功能的。
本机器的配置如下:处理器:AMD A4 或英特尔同级别处理器主频:1.2Hz以上内存:1G以上硬盘:HHD 50G或更⾼采⽤的主要技术和软件编程语⾔:Java开发环境:windows7开发软件:Eclipse 3.72、软件开发环境配置JA V A_HOME = F:\JA V A\jdkPATH = % JA V A_HOME%\bin;%JA V A_HOME%\lib;%JA V A_HOME%\jre\lib; CLASSPATH = %JA V A_HOME%\lib;%JA V A_HOME%\jre\lib;3、软件功能框图4、软件所实现的截图5、主要功能部分的源代码import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.KeyAdapter;import java.awt.event.KeyEvent;import java.util.Random;import java.util.Vector;import javax.swing.JOptionPane;import javax.swing.Timer;public class Controller extends KeyAdapter{public static Vector bangs = new Vector();public static Vector ebullets = new Vector();public static Vector pbullets = new Vector();public static Vector eplanes = new Vector();public static PPlane pplane = new PPlane();private GamePanel gamePanel;private Random random = new Random();public static int baoZhaNum;public Controller(Vector bang,Vector ebullet,Vector pbullet, Vector eplane,PPlane pplane,GamePanel gamePanel) { super(); this.bangs = bang;this.ebullets = ebullet;this.pbullets = pbullet;this.eplanes = eplane;this.pplane = pplane;this.gamePanel = gamePanel;//使⽤定时器每隔⼀秒为每⼀个敌机产⽣⼀个⼦弹Timer timer = new Timer(1000, new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubfor(int i=0;i < eplanes.size();i++){EBullet ebullet = new EBullet(eplanes.elementAt(i).x, eplanes.elementAt(i).y,8,2);ebullets.add(ebullet);}}});timer.start(); //声明定时器之后就开启定时器}@Overridepublic void keyPressed(KeyEvent e) { // TODO Auto-generated method stub switch (e.getKeyCode()){case KeyEvent.VK_UP:PPlane.UP = true;break;case KeyEvent.VK_DOWN: PPlane.DOWN = true;break;case KeyEvent.VK_LEFT: PPlane.LEFT = true;break;case KeyEvent.VK_RIGHT: PPlane.RIGHT = true;break;case KeyEvent.VK_X:PPlane.isFired = true;break;}}@Overridepublic void keyReleased(KeyEvent e) { // TODO Auto-generated method stub switch (e.getKeyCode()){case KeyEvent.VK_UP:PPlane.UP = false;break;case KeyEvent.VK_DOWN: PPlane.DOWN = false;break;case KeyEvent.VK_LEFT: PPlane.LEFT = false;break;case KeyEvent.VK_RIGHT:PPlane.RIGHT = false;break;case KeyEvent.VK_X:PPlane.isFired = false;}}public void StartRun(){new Thread(){public void run(){int count = 0; //通过count控制⼦弹避免连续按发送键时⼦弹连成线while(true){//本机移动pplane.pplaneMove();//添加本机⼦弹if(PPlane.isFired && count%5==0){PBullet pbullet1 = new PBullet(pplane.x+65, pplane.y+50, 8, 15); pbullets.add(pbullet1);PBullet pbullet2 = new PBullet(pplane.x+50, pplane.y+50, 8, 15); pbullets.add(pbullet2);PBullet pbullet3 = new PBullet(pplane.x+35, pplane.y+50, 8, 15); pbullets.add(pbullet3);PBullet pbullet4 = new PBullet(pplane.x+20, pplane.y+50, 8, 15); pbullets.add(pbullet4);}count++;//让本机⼦弹移动并判断是否打中敌机for(int i=0;i < pbullets.size();i++){pbullets.elementAt(i).bulletMove();int index = pbullets.elementAt(i).isPbulletHitEplane();if(index != -1) //不等于-1 证明打中了并产⽣爆炸{Bang bang = new Bang(pbullets.elementAt(i).x,pbullets.elementAt(i).y,30,30);bangs.add(bang);baoZhaNum++;eplanes.remove(index);}}//判断本机⼦弹出界就移除for(int i=0;i < pbullets.size();i++){if(pbullets.elementAt(i).y <= 0){pbullets.remove(i);//System.out.println("⼦弹移除");}}//添加敌机if(eplanes.size() < Global.ENEMY_NUMBER){int x = random.nextInt(Global.FRAME_WIDTH);int y = -30;EPlane eplane = new EPlane(x, y, 30, 30);eplanes.add(eplane);}//让敌机移动并且判断出界for(int i=0;i < eplanes.size();i++){eplanes.elementAt(i).eplaneMove();if(eplanes.elementAt(i).y >= Global.FRAME_HEIGHT){ eplanes.remove(i);}}//让敌机⼦弹移动并将超过边界的敌机⼦弹移除for(int i=0;i < ebullets.size();i++){ ebullets.elementAt(i).bulletMove();if(ebullets.elementAt(i).isEBulletHitPPlane()){ebullets.elementAt(i).isUsed = true;PPlane.life -= 2;}if(ebullets.elementAt(i).y >= Global.FRAME_HEIGHT){ ebullets.remove(i);}}for(int i=0;i < bangs.size();i++){if(bangs.elementAt(i).isBang == true){bangs.remove(i);}}try {sleep(30);} catch (InterruptedException e) {e.printStackTrace();}JudgeLife();gamePanel.display(bangs, ebullets, pbullets, eplanes, pplane);}}}.start();}public void JudgeLife(){if(!pplane.isAlive()){int result = JOptionPane.showConfirmDialog(gamePanel,"继续重玩?","提⽰",JOptionPane.YES_OPTION);if(result==0){newGame();}else{System.exit(0);}}}public void newGame(){bangs.clear(); //重玩必须将⼀切对象都清空ebullets.clear();pbullets.clear();eplanes.clear();pplane = new PPlane(250, 400, 100, 100);baoZhaNum = 0;pplane.life = 100; //不重置⽣命值在进⾏JudgeLife判断会⼀直出现是否重玩的对话框PPlane.DOWN = false; //重新开始游戏之后必须重置所有的静态变量否则会保存上⼀次的静态变量值运动和发射⼦弹PPlane.UP = false;PPlane.LEFT = false;PPlane.RIGHT = false;PPlane.isFired = false;}}public class PBullet extends Bullet{private Image img; //保存⼦弹的图⽚private JPanel jpanel;public JPanel getJpanel() {return jpanel;}public void setJpanel(JPanel jpanel) {this.jpanel = jpanel;}public PBullet(int x, int y, int width, int heigth) {super(x, y, width, heigth);img = new ImageIcon("Image/fire.png").getImage();// TODO Auto-generated constructor stub}public void bulletMove() {// TODO Auto-generated method stubthis.y-=20; //⼦弹的速度⼀定要⼤于飞机的速度否则⼦弹会出现在飞机后⾯}public void drawMe(Graphics g) {// TODO Auto-generated method stubg.drawImage(img, x, y, width, heigth, jpanel);}//在本机⼦弹判断是否打中敌机public int isPbulletHitEplane(){for(int j=0;j < Controller.eplanes.size();j++){Rectangle recPbullet = new Rectangle(x,y,width,heigth);Rectangle recEplane = new Rectangle(Controller.eplanes.elementAt(j).x, Controller.eplanes.elementAt(j).y,Controller.eplanes.elementAt(j).w, Controller.eplanes.elementAt(j).h);if(recPbullet.intersects(recEplane)) //判断矩形重叠{return j;}}return -1;}}6、总结JA V A和Eclipse是⼀款⾮常好的开发语⾔和平台,类的建⽴使编程相对明朗,不同的组件很明确的摆在那,对于头脑不灵活的⼈来说真的是⼀款⾮常清晰明了的开发软件,通过这⼀段时间的JA V A程序开发,我感觉到尽管的是不同的语⾔和平台,开发程序⼀样需要动脑和努⼒,每⼀款软件或者游戏都不是⼀朝⼀⼣能制作出的,都需要⼤量的构思和编程,最后还有繁琐的检查⼯作,通过这次接触JA V A我今后会更努⼒的学习它。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
大学学习即将结束,在毕业之际,我想用我4年里学习的知识为自己编写一个属于自己的游戏——飞机大战游戏,为我的大学生活画上圆满的句号。
关键词:Java游戏;面向对象;可靠安全;多线程
Design And Implementation Of Airplane Wargame Based On Java
Abstract
Nowadays, with the emergence and popularization of smart phones, plus 4 g (the 4 th Generation mobile communication, the fourth Generation mobile communication technology) the development of the Internet, more and more in the IT industry began to shift to the mobile phone industry center of gravity. Aspect of the game of the mobile phone industry profits account for a large proportion, and most mobile game is developed by Java language. So I want to keep up with the development of The Times, use Java knowledge for an in-depth understanding of the game and creation.
第3页
主要参考文献(资料):
杨大生, 陈忠. 基于Symbian平台飞机大战游戏设计[J]. 福建电脑, 2010(07):140-140
谢海军. 基于Java的手机游戏引擎的研究及实现[D]. 西南交通大学, 2007.
马鹏强. 基于J2ME的手机五子棋游戏设计与实现[D]. 电子科技大学, 2012.
Java语言在我们大学学习中占了很大的比重,其优点甚多:面向对象,可靠,安全,多平台可移植,高性能,多线程等。面向对象是相对于c语言的面向过程来说的,在面向对象编程中,我们用Java去新建一个对象,调用其方法就能实现我们的目标,并不需要了解这个对象的方法的具体实现过程;Java的可靠安全特点体现Java不支持指针,禁止第三方访问,杜绝了外部风险。所以使用Java开发游戏,是一个正确的选择。
毕业设计(论文)任务书
第1页
毕业设计(论文)题目:
基于Java的飞机大战游戏的设计与实现
毕业设计(论文)要求及原始数据(资料):
1.综述基于Java的飞机大战游戏的现状;
2.深入了解Java的设计与实现的相关技术;
3.熟练掌握Java开发工具的应用分析,训练编写游戏程序的能力;
4.设计并实现游戏中针对某一场景的研发;
陈小玉. 基才J2ME的Java手机游戏开发实例[J]. 电脑编程技巧与维护, 2005.
Ross J M. Guiding students through programming puzzles: value and examples of Java game assignments.[J]. Acm Sigcse Bulletin, 2002, 34(4):94-98.
专业班级
学生
要求设计(论文)工作起止日期
指导教师签字
日期
教研室主任审查签字
日期
系主任批准签字
日期
基于
摘
现如今,随着智能手机的兴起与普及,加上4G(the 4th Generation mobile communication,第四代移动通信技术)网络的深入,越来越多的IT行业开始向手机行业转移重心。而手机行业中游戏方面的利润所占比重较大,并且手机游戏大多数则是由Java语言开发研制的。所以我想顺应时代发展,用学到的Java知识对游戏进行一次深入的了解与创作。
Wang Y H, Wu I C, Jiang J Y. A portable AWT/Swing architecture for Java game development[J]. Software Practice & Experience, 2007, 37(7):727–745.
Zhu Y. Design and implementation of a Java game applet[J]. Computer Science & Software Engineering, 2002.
5.深入分析游戏设计中的关键技术与Java编写语言;
6.训练检索文献资料和利用文献资料的能力;
7.训练撰写技术文档与学位论文的能力。
第2页
毕业设计(论文)主要内容:
1.综述基于Java的飞机大战游戏的现状;
2.了解Java的设计与实现的相关技术;
3.熟练掌握Java开发工具的应用分析,训练编写游戏程序的能力;
4.设计并实现游戏中针对某一场景的研发;
5.深入分析游戏设计中的关键技术与Java编写语言;
6.熟练掌握基于Java语言的游戏编写;
7.设计与实现针对某一对象类的设计的程序。
学生应交出的设计文件(论文):
1.内容完整、层次清晰、叙述流畅、排版规范的毕业设计论文;
2.包括毕业设计论文、源程序等内容在内的毕业设计电子文档及其它相关材料。
周凤英, 文惺. Java游戏开发起步[J]. 电脑爱好者, 2003(14):116-116.,
陈立伟. 精通Java手机游戏与应用程序设计[M]. 中国青年出版社, 2005.
丁知平, 罗光华, 陈传起,等. 基于项目驱动的Java手机游戏开发教学方法的探讨[J]. 科技信息:科学教研, 2008(7):208-208.