1 / 20
文档名称:

java贪吃蛇论文.doc

格式:doc   页数:20页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

java贪吃蛇论文.doc

上传人:今晚不太方便 2016/3/10 文件大小:0 KB

下载得到文件列表

java贪吃蛇论文.doc

相关文档

文档介绍

文档介绍:Java 贪吃蛇毕业论文摘要近年来, java 作为一种新的编程语言,以其简单性、可移植性和平台无关性等优点, 得到了各个国家广泛地认可。本文基于 java 技术和 Eclipse 开发环境,设计并实现了一个操作简单、界面美观的“贪吃蛇”游戏。就整个游戏来说,目的是通过本游戏的设计与实现, 达到学****java 技术和熟悉软件开发流程的目的。本文先介绍了 java ,对 java 进行了概述, 然后对开发工具进行了选择,又进行了需求分析进而通过 java 语言设计并实现了贪吃蛇游戏,本系统在视图上运用了 Java 中的 Swing 技术规划界面。通过 GamePannel 这个方法画出来整个展示的面板视图。同时根据系统的需要定义了几个实体类如下(如食物、蛇、障碍物) 。并且在每个类里面定义了各自的属性和方法。像在蛇这个类里面定义蛇在前后左右移动时候会有几个位移。方法上运用了线程,控制 snake 会在运行 SnakeGameTest 这个方法运行后按照蛇头的方向不停的移动。还有定义了蛇头(在蛇吃到 food 后重新定义蛇头) 和蛇身(在吃到 food 后将 food 上添加到蛇身)。 food 这个类定义了食物的样式和判断食物被吃过后,随机的在面板上产生一个 food 。 ground 这个类定义了如何在面板上随机出现障碍物,还有对 food 的判断是否是食物并返回一个 boolean 型的值。在控制上作者创建了 controller 这个类, 并在这个类里面运用了接口事件监听键盘上下左右键对面板上的蛇进行控制,并创建了两个方法对蛇吃到东西后,对吃到的东西进行判断( 调用了 ground 类中的方法进行判断)。如果是食物则添加否则游戏结束。最后在为了整个系统融合在一块并运行时,创建了 SnakeGameTest 这个类去开启这个系统。为了保证代码的正确性和可靠性最后还进行了系统测试。关键词: java ,贪吃蛇, eclipse Abstract In recent years, the java asa new programming language, with its advantages of simplicity, portability and platform independence, has been widely recognized by all countries. Java based Eclipse development environment, design and realize a simple operation, beautiful interface namely'Snake' game. The Design and Implementation of the game attach importance to learning java technology and knowing the software development process. This article first introduces the java ,chooses developmental tools, conducts a demand analysis and then designs the Snake game through by java language .Additionally, the system uses in Java Swing technology interface. It Draws the panel view of the entire show through GamePannel . According to the needs of the system,several entity classes are defined as follows (such as food, snakes, obstacles). For example, the definition ofa snake , there will be several displacement aroud the snake. There are also defined snakeheads and snake body(the snake eat the food which will be added to the snake). The food this class defines the style of the food and judge the food which is eaten, random panel ona food. The ground of this cla