基于java的吃豆子小游戏开发-毕设论文 联系客服

发布时间 : 星期一 文章基于java的吃豆子小游戏开发-毕设论文更新完毕开始阅读

学号:

常 州 大 学 毕业设计(论文) (2012届)

题 目 学 生 学 院 专业班级 校内指导教师 专业技术职务 校外指导老师 专业技术职务

二○一二年六月

基于java的吃豆子小游戏开发

摘 要:在现今电子信息高速发展的时代,电子游戏已经深入人们的日常生活,成

为老少皆宜的娱乐方式。吃豆子游戏是一款具有活动元素的经典游戏,它曾经造成的轰动与造成的经济价值可以说是游戏史上的一件大事。自1980年 Namco(南梦宫)发布吃豆子这款游戏后,20余年一直被众玩家传玩着,经久不衰。它看似简单但却变化无穷,令人上瘾。现在联众又将重新掀起这股让人沉迷的吃豆子游戏的风潮。对一般用户来说,它的规则简单,容易上手,且游戏过程变化无穷。

本论文主要介绍如何利用图片工具Photoshop7.0,Java语言编程环境JDK,游戏开发平台Eclipse和音乐转换工具Winamp以及如何使用这些工具实现吃豆子游戏的游戏总体及构成模块。吃豆子游戏总体是有界面、控制和音乐三个主要部分组成。 ?? 吃豆子游戏的界面分为图片制作和位图载入两方面。图片采用了整体界面图片制作和区块图片制作两种方法。位图的载入是使用游戏库中的画图精灵实现的。画图精灵除了可以载入位图,还可以让界面产生图层效果;吃豆子游戏中的控制方法分为键盘控制和定时器控制两种。键盘控制是由玩家从键盘输入控制命令对游戏进行控制,而定时器控制是使用定时器对游戏进行时间控制。键盘控制包括游戏的开始与退出控制、游戏菜单的选择与确定控制和吃豆者的行动方向控制。定时器控制包括吃豆者的持续移动控制、道具的出现时间控制和道具有效时间的控制。在游戏音乐方面,分为背景音乐和特殊音效两种。背景音乐使用了循环播发模式,特殊音效使用了触发播放模式。 ??

?? ??

关键词:Java 游戏开发 画图精灵

- I -

Based on the Java Pac-Man development

Abstract:In the current of rapid development of electronic information, electronic games have become an important part of people's daily life. It has been a popular form of entertainment for all ages. Pac-man game is a classic game with elements of activity. It has caused the economic value, which can be said to be a great thing in the history of games. Since 1980, Namco had released Pac-man game, more than 20 years the game has been always playing by all players. It seems easy but changeable and addictive. Now many people turn too re-set off this addictive Pac-man game wave. For the average user, its rules are simple, easy to use, and the game process is changing.

Main of this thesis is introduction how to install the picture manufacture tool Photoshop7.0, Java language be written program environment JDK, game development environment Eclipse and music conversion tool WINAMP. And how use theses tools to realize PAC-MAN game’s total and it’s constitute parts. The game is divided into three parts: interface part, control part and music part.

Interface part is divided into picture manufacture and picture loaded in. Picture manufacture adopted the whole interface picture manufacture method and square piece picture manufacture method. Picture loaded in is using allegro’s DRAW_SPRITE complete. Control part is divided into keyboard control and timer control. Keyboard control is player use keyboard control the game. Timer control is the game was controlled by timer. Keyboard control included include the game’s start .The game’s withdraw, the menu’s control of the game and the direction’s control of Pac-man. Timer controls include Pac-man’s Keep on move. At the music pare, It is divided into the background music and special sound effect. The background music used to circularly sowed the hair mode, special sound effect to use to trigger to broadcast the mode. ?? ??

Key words: Java the game development DRAW_SPRITE

- II -

II

目录

摘 要 .............................................................................................................................................. I 目 录 ............................................................................................................................................ III 1 引言 ..................................................................................................................................................................... 1 1.1 课题研究的背景 .......................................................................................................................................... 1 1.2 国内外研究现状与发展趋势 .................................................................................................................. 2 1.3课题的意义及目的 ................................................................................................................ 3 2可行性研究 ................................................................................................................................... 4 2.1设计的目的 .................................................................................................................................................... 4 2.2 本设计的问题定义 ..................................................................................................................................... 4 2.3可行性分析 .................................................................................................................................................... 4 2.3.1技术可行性 ...................................................................................................................... 4 2.3.2操作可行性 ...................................................................................................................... 5 3.设计所用软件及环境 ................................................................................................................... 5 3.1 JAVA语言简介 ............................................................................................................................................... 5 3.2 ECLIPSE基础 .................................................................................................................................................. 7 3.3 JDK环境 ......................................................................................................................................................... 9 3.4 APPLET基础 ................................................................................................................................................. 10 4需求分析 ..................................................................................................................................... 15 4.1游戏需求 ....................................................................................................................................................... 15 4.2编程环境需求 ............................................................................................................................................. 15 4.3 接口控制 ...................................................................................................................................................... 16 5.概要设计 ..................................................................................................................................... 17 5.1游戏模块划分 ............................................................................................................................................. 17 5.2游戏流程图 .................................................................................................................................................. 18 5.3游戏地图算法流程图 ............................................................................................................................... 19 5.4 游戏音乐算法流程图 .............................................................................................................................. 20 6详细设计 ..................................................................................................................................... 21 6.1主界面设计 .................................................................................................................................................. 21 6.2本游戏的模块设计 .................................................................................................................................... 24 6.2.1墙体绘制模块设计 ........................................................................................................ 24 6.2.2豆子绘制模块设计 ........................................................................................................ 25 6.2.3吃豆者的绘制模块设计 ................................................................................................ 26 6.2.4敌人绘制模块设计 ........................................................................................................ 27 6.2.5 移动控制模块设计 ....................................................................................................... 30 6.2.6水果模块设计 ................................................................................................................ 31

- III -