基于JavaSwing的俄罗斯方块游戏的设计与实现
摘 要
俄罗斯方块是一款风靡全球,从一开始到现在都一直经久不衰的电脑、手机、掌上游戏机产品,是一款游戏规则简单,但又不缺乏乐趣的简单经典小游戏,上手容易,适用范围广泛,人所共知。俄罗斯方块游戏简单的基本规则是有小方块组成的7种不同的规则图形陆续从屏幕上落下,玩家操作移动使其下落拼出一条完整的横条,随即会消失,玩家得分,游戏等级提高,当没有被消除的图形堆积到屏幕顶端时,游戏结束。
俄罗斯方块游戏最初是由俄罗斯人阿列克谢·帕基特诺夫在1984年开发的休闲小游戏,曾几何时它创造了无可匹敌的商业价值,影响了一代休闲小游戏的开发与产业链。随着信息时代科技时代的不断发展和变化,计算机已经普及到每一个人的生活中,在繁忙的工作生活中,这一类休闲小游戏给人们带来了些许的放松。
这篇论文详细的描述分析了经典传统的俄罗斯方块实现的基本思路和一些基本游戏规则,在此基础之上,更进一步地开发出俄罗斯方块的创新创意模式,在经典游戏基础上开发出随着分数增高而等级增高难度加大的模式,并且创意性的开发出可操控方块颜色变换的模块,并且增添了游戏声音和音乐模块。本论文对上述功能给出了具体实现流程、详细描述、和一些源代码。
本论文阐述了俄罗斯方块游戏的开发和发展历史、开发此游戏的意义以及开发环境并根据软件工程开发软件和java编写程序的相关知识,对程序的需求分析、概要设计、详细设计与实现、调试运行进行了一系列描述。
此次程序设计是在Microsoft Windows 7系统下,以Java为开发语言,在Eclipse开发平台上进行游戏的设计与实现。
关键词:游戏设计;俄罗斯方块;软件工程;Java;Eclipse。
Based on the design and implementation of Java game Tetris
Abstract
Tetris is a popular all over the world, from the beginning to now has been enduring the computer, mobile phone, handheld game machine products, is a game with simple rules, but not the lack of fun, simple classic game, easy to use, wide application scope, basic rules of simple Tetris game evident to anyone. There is 7 different to the regular pattern of the composition of the small box on the screen in succession from the fall, the operation of the mobile game player to spell out the whereabouts of a complete bar, then disappear, game player score, game level, when the accumulation is not eliminated graphics to the top of the screen, the game is over.
Tetris game is the first by the Russians in 1984 Alexei Pazhitnov developed a casual game, only a short while ago it creates unmatched business value, affect the development of a generation of casual games and industrial chain. With the information age era of science and technology continuous development and change, the computer has spread to every person's life, in the busy working life, this kind of casual games brought some people to relax.
This paper gives a detailed description of the basic ideas of the traditional analysis of classic Tetris and some basic rules of the game, on this basis, further develop the creative mode in Tetris, the classic game developed with the scores increased and the higher rank of difficulty of the model, and develop creative control box color transform the module of the game, and add music and sound module. In this thesis the function given the specific implementation process, described in detail, and some of the source code.
This paper describes the development history and development of Tetris game, developed this game meaning as well as the development environment and according to the related knowledge of software engineering and software development of Java programming, analysis, outline design of program requirements, detailed design and implementation, debugging and running a series of description.
The program is designed in Microsoft Windows 7 system, with Java as the development language, Eclipse development platform for the design and implementation of the game
Key Words: Game design; Tetris, Software engineering, Java;Eclipse。
目录
基于Java的俄罗斯方块游戏的设计与实现 I
摘 要 I
Based on the design and implementation of Java game Tetris II
Abstract II
1 绪论 1
1.1程序开发背景及意义 1
1.2开发技术概述 2
1.3俄罗斯方块游戏的研究现状 2
1.3.1 国内外研究现状 2
1.3.2 文献综述 3
2相关技术 4
2.1JAVA简介 4
2.2 Swing组件简介 4
2.3Eclipse开发平台简介 5
2.4系统平台环境: 6
2.4.1 硬件平台: 6
2.4.2 软件平台: 6
3 系统分析 7
3.1可行性分析 7
3.1.1经济可行性分析 8
3.1.2技术可行性分析 8
3.1.3社会可行性分析 8
3.2需求分析 8
3.2.1 功能性需求 9
3.2.2 非功能性需求 9
3.2.3 接口控制 9
4 系统的概要设计 11
4.1 系统的功能设计 11
4.1.1 手动处理业务的基本流程 11
4.1.2 基本流程的功能模块 12
5 系统的详细设计与实现 15
5.1 游戏主界面显示模块 15
5.2 画布、方块显示模块 16
5.2.1 背景画布模块设计 16
5.2.2 预览方块模块设计 19
5.2.3 方块移动、旋转模块设计 21
5.3 控制面版模块 25
5.3.1 菜单栏模块设计 25
5.3.2 控制面板按钮设计 26
6 系统的测试运行 29
6.1 测试概述 29
6.1.1 测试原则 29
6.1.2 测试方法 30
6.1.3 测试意义及注意事项 31
6.2 游戏代码、算法的测试 31
6.3 游戏界面菜单选项的功能测试 32
6.4 按键事件的功能测试 34
6.5 方块的堆砌与消行功能测试 35
6.6 测试结果 35
结 论 36
参考文献 38
致 谢 39
附录A 外文原文 40
The psychology of Tetris 40
附录B 外文翻译 43
俄罗斯方块的心理效应 43