基于java的超级玛丽游戏的设计与实现
摘要
近年来,Java作为一种新的编程语言,以其简单性、可移植性和平台无关性等优点,得到了广泛地应用。J2SE称为Java标准版或Java标准平台。J2SE提供了标准的SDK开发平台。利用该平台可以开发Java桌面应用程序和低端的服务器应用程序,也可以开发Java Applet程序。
“超级玛丽”游戏是一个经典的游戏,它因操作简单、娱乐性强而广受欢迎。本游戏中通过总结和分析JAVA游戏的开发流程和代码功能的设计,采用面向对象的设计模式,对游戏中的所有物体赋予对象的概念和属性。开发了一款超级玛丽游戏,该游戏主要分为窗体类、场景类、马里奥类、敌人类、障碍物类等几个类。在主程序运行的线程中,用户控制的超级玛丽随方向键的操作而移动,并且可以实现马里奥游戏中的一些基本功能,例如踩死敌人或者顶掉砖块。本游戏采用双缓存技术,解决了游戏过程中的闪屏问题。通过本游戏的开发,达到学习Java技术和熟悉软件开发流程的目的。
本文在介绍Java相关技术和国内外发展现状的基础上,对“超级玛丽”游戏的整个生命周期的各个开发阶段进行了详细地介绍。为了保证程序代码的正确性和功能实现的可靠性,本文还介绍了游戏软件的程序调试过程和功能测试结果。
【关键字】:面向对象;Java;碰撞检测;超级玛丽
Design and implementation of java-based Super Mario game
Abstract
In recent years, Java as a new programming language, with its simplicity, portability and platform independence, etc., have been widely used. J2SE called Java Standard Edition or Java standard platforms. J2SE SDK provides a standard development platform. You can use the platform to develop Java desktop applications and low-end server applications, you can develop Java Applet program.
"Super Mario" game is a classic game, because it is simple, entertaining and popular. The game features through the development process and code design summary and analysis of JAVA games, using object-oriented design patterns, all objects of the game gives the concept of objects and attributes. Developed a Super Mario game, the game is divided into several classes form class, class scene, Mario class, class enemies, obstacles and so on. In the main thread running, user-controlled Super Mario with the arrow keys to move the operation, and can achieve Mario game some basic functions, such as stepping on the enemy or top off the bricks. The game uses dual caching technology to solve the game during the splash screen problem. Through the development of this game, to learn Java technology and familiar with software development process purposes.
This paper describes the state of the art related to the development of Java and abroad on the basis of the various development stages of "Super Mario" game for the entire life cycle of a detailed introduction. In order to ensure the correctness of the program code and functions to achieve reliability, this article describes the game software debugging process and functional test results.
Key words: Object-Oriented,java,Collision Detection, Mario
目 录
1、绪论11
1.1背景以及现状11
1.2 Java语言的特点 12
1.3 系统运行环境及开发软件: 12
1.4 可行性的分析 13
1.4.1 技术可行性13
1.4.2 经济可行性 13
1.4.3 操作可行性 14
2、 需求分析14
2.1 用户需求分析14
2.2功能需求分析15
2.3界面设计需求分析15
3、 系统概要设计16
3.1系统模块设计16
3.1.1窗体类16
3.1.2初始化类17
3.1.3背景类18
3.1.4马里奥类18
3.1.5障碍物类19
3.1.6敌人类19
3.2系统流程设计20
4、 系统详细设计21
4.1 设计目标21
4.2 系统模块设计22
4.2.1窗体类22
4.2.2初始化类26
4.2.3背景类28
4.2.4马里奥类31
4.2.5障碍物类37
4.2.6敌人类39
5、系统的实现42
5.1游戏开发所需要的图片42
5.1.1马里奥的所有图片42
5.1.2游戏中障碍物的图片43
5.1.3游戏中怪物的图片44
5.1.4游戏中的背景图片44
5.1.5游戏开始时的图片45
5.2游戏设计的界面45
5.2.1 游戏逻辑展示45
5.2.1 游戏逻辑展示46
6、系统测试48
6.1 测试的意义48
6.2 测试过程49
6.3 测试结果49
7、总结与展望50
7.1 总结 50
7.2 设计中的不足之处 51
7.3 展望 51
致 谢52
外文原文53
外文翻译57