基于VC++的推箱子游戏设计与实现 下载本文

内容发布更新时间 : 2024/9/29 20:56:51星期一 下面是文章的全部内容请认真阅读。

摘 要

近年来随着科技的飞速发展, Visual C++语言的应用正在不断深入。Visual C++语言是当今国际上非常流行的计算机高级编程语言之一,它是面向对象的可视化集成编程系统。它不但具有程序框架自动生成、灵活方便的类管理、代码编写和界面设计集成交互操作、可开发多种程序等优点,而且通过简单的设置就可使其生成的程序框架支持数据库接口、OLE2,WinSock网络、3D控制界面。它更以自动编译功能和高级除错功能著称。因此,广泛受到编程人员青睐。不仅适合作为系统描述语言,也用来编写系统软件,还可以用来编写应用软件和设计游戏等。

本论文着重分析用Microsoft Visual C++语言实现一个较为简单的推箱子游戏,旨在介绍推箱子游戏的实现方法,并逐步介绍Microsoft Visual C++6.0图形编程的方法和技巧。本设计通过主界面对话框类、关口选择对话框类、帮助对话框类三大类以及键盘操作模块、游戏规则模块、地图文件读取模块、背景音乐播放模块、地图绘制模块,共五大模块构成。实现了任意关数选择、难度依次加大、游戏步数记录、背景音乐播放、游戏帮助、胜负判断等多个功能,采用图形函数的使用实现了一个完整的推箱子游戏界面,界面清晰可见。

关键词:推箱子,c++语言, 模块,图形编程

Abstract

In recent years, with the rapid development of science and technology, Visual C + + language application are continuously in depth. Visual C + + language is very popular on the current international advanced programming languages of the computer, it is an object-oriented programming system integration of visualization. It not only has the program frame automatically generate, flexible convenient class management, coding and interface design integration, can develop a variety of interactive operation procedures and other advantages, and through the simple Settings will be able to make its generated programming framework support database interface, OLE2, WinSock network, 3 D control interface. It more for automatic compiler function and senior debugging is famous for its function. Therefore, widely favored by programming staff. Not only for the system description language, which is also used to write the system software, can also be used to write application software and game design, etc.

This paper focuses on analyzing with Microsoft Visual C + + language realize a relatively simple pushed box game, is to introduce the realization method of game pushed box, and gradually introduce Microsoft Visual C++ 6.0 graphics programming methods and techniques. This design through the main interface dialog box class, pass options dialog box class, help dialog box class three categories and keyboard module, the rules of the game module, map reading modules, background music files play module, map module, a total of five module. Realize the random number, the difficulty in turn off choice, the more steps, background music record game play, the game won more than judgement to help, the function, the use of graphics functions achieved a complete pushed box game interface, interface can be clearly seen.

Key word: boxman, C++ language, modules, graphics programming

目 录

1 绪论 .............................................................................................................................. 1

1.1课题研究的意义 ................................................................................................. 1 1.2国内外研究动态 ................................................................................................. 2

1.2.1推箱子游戏的研究动态 ........................................................................... 2 1.2.2国内外研究现状及分析 ........................................................................... 3

2 课题研究相关技术与分析 .......................................................................................... 6

2.1 Microsoft Visual C++6.0概述 ......................................................................... 6 2.2 可行性研究与需求分析 .................................................................................. 7 3 推箱子游戏的总体设计 .............................................................................................. 9

3.1推箱子游戏概述 ................................................................................................. 9 3.2 推箱子游戏的基本要求 .................................................................................. 9

3.1.1 开发软件及硬件环境要求 .................................................................... 9 3.1.2 运行环境 ................................................................................................ 9 3.1.4 测试环境操作系统与硬件配置 ............................................................ 9 3.1.4 界面要求 ................................................................................................ 9 3.3 推箱子游戏具有的功能 .................................................................................. 10 3.3 推箱子游戏系统设计 ....................................................................................... 11

3.3.1 推箱子游戏功能架构 ........................................................................... 11 3.3.2 程序结构设计 ....................................................................................... 11 3.3.3 出错处理设计 ...................................................................................... 12 3.3.4 维护设计 .............................................................................................. 13 3.4游戏界面设计 ................................................................................................... 13

3.4.1 游戏主界面的设计 .............................................................................. 13 3.4.2 游戏菜单结构的设计 .......................................................................... 13 3.4.3 游戏中关口选择对话框的设计 .......................................................... 14

4 推箱子游戏的设计与实现 ........................................................................................ 15

4.1推箱子游戏的界面实现 ................................................................................... 15

4.1.1 游戏菜单的实现 .................................................................................. 15