参考论文4-基于Java的游戏“俄罗斯方块”的设计与实现
- 格式:doc
- 大小:1.85 MB
- 文档页数:99
西南交通大学本科毕业设计基于Java的游戏“俄罗斯方块”的设计与实现年级: 2002级学号: 20027102姓名: 赵凌专业: 电气工程及其自动化指导老师: 黄进2006年6月院系电气工程学院专业电气工程及其自动化年级2002级姓名赵凌题目基于Java的游戏“俄罗斯方块”的设计与实现指导教师评语指导教师(签章) 评阅人评语评阅人(签章) 成绩答辩委员会主任(签章)年月日毕业设计(论文)任务书班级电气2002级2班学生姓名赵凌学号20027102发题日期:2006年3月6日完成日期:6月20日题目基于Java的游戏“俄罗斯方块”的设计和实现1、本论文的目的、意义本次毕业设计的目的在于学习Java程序设计基本技术,学习用JBuilder开发Java程序的相关技术,熟悉游戏“俄罗斯方块”的需求,熟悉项目开发的完整过程。
通过本次毕业设计,学生应该学会怎样进行一个项目的需求分析、概要设计、详细设计等软件开发过程,熟练地掌握Java程序设计的基本技术和方法,熟练地掌握JBuilder环境的使用方法,培养起初步的项目分析能力和程序设计能力,把理论与实践相结合,为今后工作打下坚实的基础。
2、学生应完成的任务学生应完成项目的需求分析、概要设计、详细设计等前期工作,在此基础上,采用基于Java的程序设计技术完成游戏“俄罗斯方块”的基本功能,包括:游戏控制功能(游戏的开始、暂停和恢复),游戏设置功能(设置方块下移速度),游戏排行榜功能(存储成绩)等,最终完成毕业设计说明书的攥写。
3、设计各部分内容及时间分配:(共12 周)第一部分收集相关资料及熟悉开发语言和环境(2周)第二部分系统主界面模块(1周)第三部分游戏控制模块(3周)第四部分游戏设置模块(1周)第五部分游戏排行榜模块(1周)第六部分毕业设计说明书的撰写、初评、修改及定稿(3周)评阅及答辩(1周)备注指导教师:黄进2006年3月6日审批人:年月日摘要近年来,Java作为一种新的编程语言,以其简单性、可移植性和平台无关性等优点,得到了广泛地应用,特别是Java与WWW的完美结合,使其成为网络编程和嵌入式编程领域的首选编程语言。
JBuilder是Borland公司用于快速开发Java应用的一款优秀的集成开发环境,它以其友好的开发界面、强大的组件支持等优点,得到广大程序员的接受和认可。
“俄罗斯方块”游戏是一个经典的传统游戏,它因操作简单、娱乐性强而广受欢迎。
现在,人们已不满足于传统游戏简单的功能,已对该游戏在功能上有了更多的需求。
本文基于Java技术和JBuilder开发环境,开发了一个操作简单、界面美观、功能较齐全的“俄罗斯方块”游戏。
整个游戏程序分为四个功能模块,九个类模块,实现了游戏的开始、暂停、结束、排名、查看分数排名、游戏级别的设置、分数和级别的显示、新生方块的预览、方块的翻转、方块的移动、方块的直落等功能。
通过本游戏的开发,达到学习Java技术和熟悉软件开发流程的目的。
本文在介绍Java和JBuilder相关技术和国内外发展现状的基础上,对“俄罗斯方块”游戏的整个生命周期的各个开发阶段进行了详细地介绍。
首先,分析了开发本游戏软件的可行性,重点分析本设计所采用的技术的可行性。
其次,从游戏主界面、游戏方块下落速度、游戏分数以及游戏排行榜等几方面,分析了本游戏的功能需求;从可使用性和安全性方面分析了属性需求。
然后,进行了游戏的概要设计和详细设计,这也是本文的重点。
概要设计给出四个功能模块的主框架以及九个类模块的函数调用关系;详细设计介绍了Java2标准运行环境的配置,重点给出各个类模块的程序流程图以及UML图,列表介绍了各个类包含的变量、使用的方法,简单叙述了游戏安装文件的生成,展示了游戏的界面。
为了保证程序代码的正确性和功能实现的可靠性,本文还介绍了游戏软件的程序调试和功能测试结果,并且对本设计的成果和不足进行了总结。
最后,本文还提出软件的维护措施。
关键词:Java;JBuilder;“俄罗斯方块”游戏AbstractRecently, due to its simplicity, transportability and depend from the platform, the programme language of Java has got popular application especially when it has been combined with WWW as the first-chosen programme language in the field of network programme and programme-embeded. JBuilder is an excellent integrated development environment, which was utilized by the corporation of Borland to design the application of Java and has got extensive recognition among most programmer due to its good design interface, the support of perfect modules and so on.“Russian Blocks”is a classical and traditional game.It is very popular because of its simple operation and strong amusement.There has been more requirement on function of the game that the old function of traditional game has not been enough to people. Based on the Java technology and JBuilder integrated development environment,the paper design a game of“Russian Blocks” with simple operation,perfect interface and complete functions. The programme are composed of four functional modules and nine class-modules, all of which will realize the following functions: game’s begin, pause, end, taxis, examine the mark list in sequence, setup of rank, display of rank and mark, preview of new block, upturn of block, move of block, fall of block and so on.The purpose of developing this game gains the ends of not noly the study of Java technology but also the familiarity of software development process.Based on the introduction of Java and JBuilder technology,this paper specifies every process of the lifecycle of the game of “Russian Blocks”.First of all,this paper analyses the feasibility of developing the game software and emphasizes the technical feasibility of the design .Secondly,the requirement on function of this game is analysed onseveral aspects:the main interface of the game,downturn speed of block,score and the game list in sequence and so on.In addition,the requirement on property is also analysed on both usability and security. And then,this paper carries through the general design and the detail design which are the emphases of this paper. Main frame of four functional modules and the function-called relationship of nine class-modules are shown in the general design;the detail design introduces the configuration of Java 2 Runtime environment,and point out programme flow chart and UML chart of every class module. The detail design also introduces the variables and methods included in every class and specifies how to make installation of this game software.The interface of game was displayed in the end of the detail design. In order to ensure correctness of code and dependability of the function,the programme has been debugged,and the function has been tested,and then the fruit and shortage of this design has been summarized. Finally,this paper proposes the maintenance measures of the game software.Key Words: Java;JBuilder;the game of “Russian blocks”目录第1章绪论 (1)1.1 本设计的目的和意义 (1)1.2 国内外研究现状 (1)1.3 设计研究的主要内容、目标与工具 (2)1.3.1 设计的主要内容 (2)1.3.2 设计要达到的目标 (3)1.3.3 设计方法介绍 (3)第2章可行性分析 (7)2.1 可行性分析 (7)2.1.1 可行性研究的前提 (7)2.1.1.1 要求 (7)2.1.1.2 目标 (8)2.1.1.3 条件、假定和限制 (8)2.1.2 对现有软件的分析 (8)2.2 所建议的软件 (9)2.2.1 游戏处理流程 (9)2.2.2 社会可行性分析 (10)2.2.3 技术可行性分析 (11)2.2.3.1 执行平台方面 (11)2.2.3.2 执行速度方面 (12)2.2.3.3 语言特性与功能方面 (12)2.2.3.4 开发环境方面 (13)2.2.3.5 JBuilder开发工具 (13)2.2.4 经济可行性 (13)第3章需求分析 (14)3.1 任务概述 (14)3.1.2 用户的特点 (14)3.2 具体需求 (14)3.2.1 功能需求 (14)3.2.1.1 游戏主界面模块需求 (14)3.2.1.2 游戏图形区域界面的需求 (15)3.2.1.3 方块下落速度需求 (15)3.2.1.4 游戏分数需求 (15)3.2.1.5 游戏排行榜需求 (15)3.2.2 属性需求 (15)第4章概要设计 (16)4.1 游戏功能 (16)4.2 功能模块设计 (16)4.2.1 总设计模块的划分 (16)4.2.2 游戏主界面模块 (17)4.2.3 游戏控制模块 (17)4.2.4 游戏设置模块 (18)4.2.5 游戏排行榜模块 (18)4.3 类模块设计 (19)4.3.1 类模块之间关系 (19)4.3.2 各类模块设计概要 (19)4.3.3 类和Java源文件对应关系 (20)4.4 程序设计的重点 (21)4.4.1 游戏图形界面的图形显示更新功能 (21)4.4.2 游戏方块的设计 (21)4.5 接口设计 (22)4.5.1 外部接口 (22)4.5.2 外部接口 (22)4.6 维护设计 (22)第5章详细设计 (24)5.1 程序主结构 (24)5.2 开发环境配置 (24)5.2.1 Java2的标准运行环境 (24)5.2.1.1 J2SE SDK (24)5.2.1.2 J2SE JRE (25)5.2.1.3 J2SE Documentation (25)5.2.2 J2SE的安装与配置 (25)5.2.2.1安装过程 (25)5.2.2.2 配置环境变量 (28)5.3 类模块程序流程图 (31)5.3.1 BlockGame类 (31)5.3.2 BlockFrame类 (32)5.3.3 Square类 (32)5.3.4 LevelDialog类 (32)5.3.5 Game类 (32)5.3.6 Score类 (34)5.3.7 SaveScoreDialog类 (34)5.3.8 ReportDialog类 (35)5.3.9 AboutDialog类 (35)5.4 类模块具体设计 (35)5.4.1 BlockGame.java程序 (35)5.4.2 BlockFrame.java程序 (36)5.4.2.1 BlockFrame类程序 (36)5.4.2.2 Game类程序 (37)5.4.2.3 LevelDialog类程序 (40)5.4.2.4 BlockFrame.java的UML图 (40)5.4.3 Score.java程序 (42)西南交通大学本科毕业设计第X页5.4.4 SaveScoreDialog.java程序 (43)5.4.5 Reportdialog.java程序 (46)5.4.6 AboutDialog.java程序 (48)5.4.7 Square.java程序 (49)5.5 安装文件的生成 (50)5.5.1 inno setup简介 (50)5.5.2 安装文件制作步骤 (50)5.6 游戏界面展示 (54)第6章软件测试 (58)6.1 程序代码调试 (58)6.1.1 用正常数据调试 (58)6.1.2 异常数据调试 (58)6.1.3 用错误数据调试 (58)6.2 程序功能测试 (58)6.2.1 模块功能测试 (59)6.2.2 确认测试 (60)第7章软件维护 (61)结论 (62)致谢 (63)参考文献 (64)附录“俄罗斯方块游戏”程序源代码 (65)第1章绪论1.1 本设计的目的和意义俄罗斯方块游戏具有广泛的用户群,因为它比较简单有趣,无论老少都比较适合。