当前位置:文档之家› Java小游戏俄罗斯方块附完整源代码_毕业设计

Java小游戏俄罗斯方块附完整源代码_毕业设计

**** 届毕业设计Java小游戏俄罗斯方块┊┊┊┊┊┊┊┊┊┊┊┊┊装┊┊┊┊┊订┊┊┊┊┊线┊┊┊┊┊┊┊┊┊┊┊┊┊摘要在现今电子信息高速发展的时代,电子游戏已经深入人们的日常生活,成为老少皆宜的娱乐方式。

但是游戏设计结合了日新月异的技术,在一个产品中整合了复杂的设计、艺术、声音和软件,所以并不是人人皆知。

直到今天,在中国从事游戏设计的人仍然很少,但是游戏行业的发展之快,远超如家电、汽车等传统行业,也正因为如此,游戏人才的教育、培养远落后于产业的发展。

俄罗斯方块是个老幼皆宜的小游戏,它实现由四块正方形的色块组成,然后存储在一个数组的四个元素中,计算机随机产生不同七种类型的方块,根据计算机时钟控制它在一定的时间不停的产生,用户根据键盘的四个方向键控制翻转、向左、向右和向下操作,(控制键的实现是由键盘的方向键的事件处理实现)。

然后程序根据这七种方块堆叠成各种不同的模型。

论文描述了游戏的历史,开发此游戏的环境,游戏开发的意义。

遵循软件工程的知识,从软件问题定义开始,接着进行可行性研究、需求分析、概要设计、详细设计,最后对软件进行了测试,整个开发过程贯穿软件工程的知识体系。

此次设计在Microsoft Windows 7系统下,以Java为开发语言,在eclipse开发平台上进行游戏的设计与实践。

从游戏的基本玩法出发,主要就是俄罗斯方块的形状和旋转,我在设计中在一个图片框中构造了一些的网状小块,由这些小块组合成新的形状,每四个小块连接在一起就可以构造出一种造型,因此我总共设计了7中造型,每种造型又可以通过旋转而变化出2到4种形状,利用随机函数在一个欲览窗体中提前展示形状供用户参考,在游戏窗体中用户就可以使用键盘的方向键来控制方块的运动,然后利用递归语句对每一行进行判断,如果有某行的方块是满的,则消除这行的方块,并且使上面的方块自由下落,最后就可以得出用户的分数。

关键词:游戏设计,算法,数组,事件┊┊┊┊┊┊┊┊┊┊┊┊┊装┊┊┊┊┊订┊┊┊┊┊线┊┊┊┊┊┊┊┊┊┊┊┊┊ABSTRACTIn today's era of rapid develop ment of electronic information, electronic games has penetrated people's daily lives,become enter tain ment for all ages. But, art, sound and software, not known.Until today, the Chinese people in the game design is still very small, but the game industry's rapid development, far more than such as house hold appliances, auto mobiles and other traditional industries, but also because of this,the game personnel education and training is far behind the develop ment of the industry. Te tris is a game for all ages,it is achieved by the fours quare blocks of color, and then stored in an array off our elements, the computer randomly generated seven types of boxes, according to the computer clock to control it in a certain time to stop the generation of the user according to the four key board arrow keys to control the flip, left, right and down operation(control key implementation is provided by the arrow keys on the keyboard event hand ling to achieve).Then the program under these seven boxes stacked into a variety of different models.Paper describes the history of the game, the develop ment environ ment for this game, game develop ment significance.Follow software engineering knowledge,from a software problem definition, followed by feasibility studies,needs analysis, out line design, detailed design, and finally the software has been tested throughout the development process through out the software engineering body of knowledge. The design in Microsoft Windows XP system,for the development of the ,in eclipse develop ment platform for game design and practice.The design in Microsoft Windows 7 system, for the development of the Java language, in eclipse development platform for game design and practice. Starting from the basic game play, mainly the shape and rotation of Tetris, I have a picture box in the design of some mesh pieces constructed from a combination of these pieces into a new shape, connected to each of the four pieces together, they can construct a kind of shape, so I designed a total of 7 shapes, each shape and can be varied by rotating the 2-4 kinds of shapes, using the random function in a form previewed to browse shapes for users reference in the game form the user can use the keyboard arrow keys to control the movement of boxes, and then use the recursive statement for each line judge, if there is a line in the box is full, then remove this line in the box, and make the box above free-fall, and finally can be drawn on the user's score.Keywords:game design,algorithm,arrays,event┊┊┊┊┊┊┊┊┊┊┊┊┊装┊┊┊┊┊订┊┊┊┊┊线┊┊┊┊┊┊┊┊┊┊┊┊┊目录第一章绪论 (1)1.1游戏的历史 (1)1.1.1 从头谈起 (1)1.1.2 图形硬件的革命 (2)1.2游戏的意义与内涵 (2)1.2.1 游戏的组成要素 (2)1.3 Java的定义 (3)1.4 Applet的定义 (8)1.5 JDK简介 (9)第二章可行性研究 (11)2.1 设计目的 (11)2.2 可行性研究前提 (11)2.3 可行性分析 (11)2.4 结论意见 (12)第三章需求分析 (13)3.1 引言 (13)3.2 游戏需求 (13)3.3 软硬件需求 (13)3.4 接口控制 (14)3.5 方案论证 (14)3.5.1 VB的优点 (14)3.5.2 C++的优点 (14)3.5.3 Java的优点 (14)3.5.4方案选择 (16)第四章概要设计 (17)4.1 游戏设计分析 (17)4.2 注意事项 (18)4.3 游戏流程图 (18)第五章详细设计 (20)5.1 总体设计 (20)5.2 屏幕信息初始化(paint()) (21)5.3 方块的装载(begin()) (23)5.4 处理键盘事件 (25)5.5 方块变化(change()) (26)5.6 控制游戏速度与自动下降(run()) (28)5.7 处理到达事件 (30)5.8 判断满行及消行 (32)5.9 显示控制 (34)5.10 保存方块坐标(save()) (34)┊┊┊┊┊┊┊┊┊┊┊┊┊装┊┊┊┊┊订┊┊┊┊┊线┊┊┊┊┊┊┊┊┊┊┊┊┊5.11 处理游戏结束 (34)第六章总结 (35)致谢 (36)参考文献 (37)附录主要代码展示及详解 (38)第一章绪论1.1游戏的历史游戏开发至今已经有30多年,在这个短暂的时期里,随着硬件水平的提高,游戏开发新技术层出不穷,经典游戏比比皆是。

电子游戏,也就是运行在家用电脑、家用电子游戏机或是掌中宝游戏机及街机上的电子游戏程序。

电子游戏是一种结合剧情故事、美术、音乐、动画、程序等技术于一身的互动型娱乐软件,涉及到多个行业。

从电子游戏的分类来看,有着多种分类方式。

传统的游戏分类是按照游戏类型,将其分为即时战略游戏、第一人称射击游戏、角色扮演游戏、策略型游戏等类别。

相关主题