毕业设计扫雷_第1页
毕业设计扫雷_第2页
毕业设计扫雷_第3页
毕业设计扫雷_第4页
毕业设计扫雷_第5页
已阅读5页,还剩17页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1 / 22 毕业设计扫雷 基于 Java 扫雷游戏的设计与实现 院 系:计算机与电子系 专 业 班:计算机应用技术 0902 班 姓 名:张峥 学 号: 20162911052 指导教师:彭 文 艺 2016 年 6 月 基于 Java 扫雷游戏的设计与实现 Design and Implementation of Java Minesweeper Game 摘 要 Java 是一种可以撰写跨平台应用软件 的面向对象的程序设计语言,是由 Sun Microsystems 公司于 1995 年 5月推出的 Java 程序设计语言和 Java 平台的总称。在硬件或操作系统平台上安装一个 Java 平台之后, Java 应用程序就可运行。 Java 是一种简单的,面向对象的,分布式的,解释型的,健壮安全的,结构中立的,可移植的,性能优异、多线程的动态语言。 Java 技术具有卓越的通用性、高效性、平台移植性和安全性,广泛应用于个人 PC、数据中心、游戏控制台、科学超级计算机、移动电话和互联网,同时拥有全球最大的开发者专业社群。在全球云计算和移动互联 网的产2 / 22 业环境下, Java 更具备了显著优势和广阔前景。 近年来 Java 作为一种新的语言,以其简单性,平台无关性和可移植性等优点,得到了广泛的应用,特别是 Java与万维网的完美结合,使其成为网络编程和嵌入式编程领域的首选编程语言。 JBuilder 是 Bola 公司用于快速开发 Java应用的一款优秀的集成开发环境,它以其友好的的开发界面,强大的组件支持等优点,得到了广大程序员的接受与认可。 本论文研究的是以 Eclipse 为开发环境,设计并开发一款扫雷游戏,其功能类似于 Windows 操作系统自带 的扫雷游戏。论文首先介绍了制作游戏的整体思路及整个游戏设计的流程规划,然后介绍了雷区的布置及地雷随机产生的实现方法;重点介绍了在游戏过程中各事件的处理。 关键词: Java 扫雷 Eclipse Abstract Java is a cross-platform application software can write object-oriented programming language, the general term of the Java programming language by Sun Microsystems, Inc. in May 1995 and the Java platform. Hardware or operating system platform to install a Java platform, Java applications can run. Java is a simple, object-oriented, distributed, interpreted, robust 3 / 22 security, the structure-neutral, portable, high-performance, multithreaded dynamic language. Has excellent versatility, efficiency, platform portability, and security of Java technology, widely used in personal PC, the data center, game consoles, scientific supercomputers, mobile phones and the Internet, while the worlds largest developer of professional community . Global cloud computing and mobile Internet industry environment, Java has significant advantages and broad prospects Java in recent years as a new language, with its advantages of simplicity, platform independence and portability, get a wide range of applications, especially Java and the World Wide Web perfect binding, making it the network programming and embedded programming the preferred programming language. JBuilder is an excellent integrated development environment Borlan company for rapid development of Java applications, and its friendly development interface, powerful component supports, etc., has been accepted and recognized by the majority of programmers This thesis is based on the Eclipse development 4 / 22 environment, design and develop a mine-sweeping game, its function is similar to minesweeper game that comes with Windows operating system. The paper first introduces the idea of making the game as a whole and the entire game design process planning, and randomly generated minefield layout and mine; focuses on the handling of events in the course of the game. Key words: Java Minesweeping Eclipse 目 录 摘要 . Abstract . 绪论 . 1 1 开发环境 .5 / 22 . 2 开发工具 . 2 应用环境 . 2 编写意义 . 2 任务设计内容 . 3 2 可行性分析和需求分析 . 4 可 行 性 分析 . 4 6 / 22 需求分析 . 5 3 概要设计 . 6 4 详 细 设计 . 8 MineGame类 . 8 MineArea类 . 9 Block类 . 11 BlockView类 .7 / 22 . 12 LayMines类 . 12 Record类 . 13 showRecord类 . 14 5 系统测试 . 16 结论 . 20 致谢 . 21 参考文献 .8 / 22 . 22 济源职业技术学院 毕业设计 题目 基于 Qt 的扫雷游戏设计 系别 信息工程系 专业 计算机应用技术 班级 计应 1002 班 姓名 常慧珍 学号 10090224 指导教师 李攀 日期 二零一二年九月 基于 Qt 的扫雷游戏设计 总计:毕业设计 25 页 图表 10 幅 摘 要 扫雷游戏是一款经典的小游戏,这款游戏不仅可以让人们充分享受娱乐的目的,而且可以通过这款小游戏开发人的逻辑推理能力和判断能力。本次毕业设计我们以为开发环境,设计并开发 了基于 Qt 的扫雷游戏。 扫雷游戏主要研究以下两个方面: 第一是初始化问题,包括随机产生本局游戏中的雷数,雷的分布对于每个小区域如何获得周围地区分布的雷数9 / 22 等等。 第二就是对鼠标事件的处理,即在游戏过程中对鼠标事件应如何做出反应。 本论文以 Qt 作为开发软件,首先使用信号与槽的方法实现菜单、工具栏的功能,其次又以MousePressEvent 鼠标事件发出信息来了解使用者的意图,进而做出相对应的动作,再次介绍了清除地雷区方块的方法,通过递归程序的编写,在程序代码上会变得相当简洁。最后利用布局管理组进行整体布局。 使用 C+语言设计完成了扫雷游戏的初始化界面,实现了扫雷游戏的计时、重新开始、难度设置、排行榜、帮助等功能。还增加了游戏在成败时弹出对话框等功能。总的来说本次设计在功能上已经基本达到预期的要求。但还有一些不足,比如扫雷游戏设计还可以添加一些背景音乐、背景图片、视频等功能,更能增加人们的娱乐性。 关键词:扫雷游戏; Qt; C+ ABSTRACT Minesweeper game is a classic game, the game can not only allow people to fully enjoy the entertainment purposes, and by this small game development logical reasoning ability and judgment. The graduation project to development environment, design and development of Qt-based game of Minesweeper. The minesweeper game the 10 / 22 following two aspects: The first is the initialization problems, including randomly generated number of Council Game Ray Ray distribution for each small area how to get around the geographical distribution of Ray. The second is the processing of mouse events, mouse events in the course of the game how to react. In this thesis, QT signals and slots as the development of software, the first to use the method to achieve the functionality of the menus, toolbars, followed Youyi mousePressEvent mouse events issued information to understand the users intent, and then make a corresponding action, again introduced a clear Minefields box by recursive program code will become quite simple. Finally, the the layout management group overall layout. Completed minesweeping games initialization interface design, to achieve a mine-sweeping game of timing, start again, difficulty settings, rankings, help functions using the C language. Game in the success or failure of the pop-up dialog box. Overall, the design function has basically reached the expected requirements. But there are some disadvantages, such 11 / 22 as minesweeping game design can also add some background music, background image, video, and can help increase peoples entertainment. Keywords: Minesweeper game; Qt; C+ 目 录 摘 要 . I ABSTRACT . II 第 1 章 绪论 . - 1 - 研 究 背景 . - 1 - 研 究 原因 .12 / 22 . - 1 - 研 究 意义 . - 1 - 第 2 章 Qt 简介 . - 2 - Qt 特征 . - 2 - Qt 核 心 编 程 技术 . - 2 - 元 对 象 系统 . - 2 - 信 号 和 槽 机制 .13 / 22 . - 3 - QObject类 . - 3 - 对象树 . - 3 - 事件 . - 3 - QApplication类 . - 3 - QWidget类 . - 4 - 基 本 布局 . - 4 - C+ 面 向 对 象 程 序 设14 / 22 计 . - 4 - Qt 程 序 用 到 的类 . - 5 - Qt 应 用 程 序 实现 . - 5 - 本 章 小结 . - 6 - 第 3 章 扫 雷 游 戏 设计 . - 8 - 扫 雷 游 戏 功 能 需 求 分析 . - 8 - 扫 雷 游 戏 整 体 框 架 介绍 . - 8 - 15 / 22 扫 雷 游 戏 主 要 功 能 的 实现 . - 9 - 菜 单 栏 的 实现 . - 9 - 菜 单 栏 的 功能 . - 11 - 鼠 标 事 件 的 实现 . - 11 - 完 成 扫 雷 游 戏 逻 辑 的 设计 . - 12 - 扫 雷 游 戏 状 态 分类 . - 12 - 初 始 化 界 面 功 能 实现 . - 13 - 雷 区 的 随 机 布16 / 22 置 . - 13 - 清 除 未 靠 近 地 雷 的 方块 . - 14 - 游 戏 的 判断 . - 15 - 目录 前言 . 1 1 扫雷游戏概述 . 2 基本信息 . 2 游 戏 玩 法 简介 . 2 2 系 统 平 台 与 技 术 选择 . 3 开发语言与工17 / 22 具 . 3 技术选择 . 3 3 扫雷游戏需求分析 . 4 编写需求分析的目的 . 4 功组织结构图 . 4 4 扫雷游戏软件总体设计 . 5 主 要 功 能 模 块 划分 . 5 设计步骤流程 . 6 5 扫雷游戏程序详细设计 . 8 编写详细设计的目的 . 8 单 机 版 扫 雷 游 戏 的 实现 . 8 完 成 单 机 版 扫 雷 游 戏 界 面 设18 / 22 计 . 9 单机游戏状态转换图 . 11 网络扫雷的实现 . 12 6 程 序 功 能 完 善 与 优化 . 17 增加音乐效果 . 17 保存功能 . 17 发送鼠标功能的优化 . 17 增加排行榜功能 . 18 增 加 首 次 点 击 不 会 点 到 雷 的 功能 . 18 增 加 网 络 版 双 方 玩 家 点 击 计数 . 19 增加聊天功能 . 19 7 网络扫雷游戏功能测19 / 22 试 . 20 8 结 论 . 28 总 结 . 29 致 谢 . 30 参 考 文 献 . 31 附录 . 32 摘 要 本软件是一款具有联机功能的扫雷游戏,并且具有单机游戏功能。 联机功能采用 C/S 模型,通过服务器程序中转消息,完成对游戏消息的传送。程序功能丰富,具有多种难度,且带有保存,排行榜,聊天等功能。 程序的设计采用了模块化程序设计的方法,对底层模块和经常被调用的函数,进行封装。使得单机扫雷游戏与20 / 22 网络版的扫雷都可以共用底层的游戏逻辑。且使得在单机版的基础上实现网络功能变得简单。 游戏界面美观,显示的数字和地雷都用贴图实现。 关键词:扫雷游戏; C/S 模型;服务器; Abstract This software is a mine sweeper game with online features and functionality with a single game. Online features using C / S model, the game send the the message through the server program . This program has a lot of functions,like a variety of difficulty, and with a save,high scores, chat and other functions. Program was designed with a modular design method, often called the bottom of the module and function of the package. Makes the game stand-alone mine clearance and the network version of the game can share the underlying logic. And makes on the basis of stand-alone networking simple. Game interface is beautiful, showing the number and mine playground with the bitmap.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论