基于pygame2D游戏开发框架的飞机对战游戏的设计与实现

 2023-01-16 08:01

论文总字数:17786字

摘 要

Pygame是基于SDL(Simple DirectMedia Layer)库开发的python语言专用的游戏库。SDL 是一个跨平台C库,它与DirectX相当,在近年来已经被用于数百种商业和开源游戏的开发。本课题旨在研究python应用程序开发方法,并从游戏的设计、开发、测试等各个方实践2D游戏的开发设计流程。

本课题首先会从游戏需求分析开始,分模块分析各个游戏模块的功能需求。其次通过流程图的方式对游戏流程进行整体概要设计。之后用E-R图的方式设计游戏内部数据之前的实体关系,并对游戏中的数据库进行详细设计。然后根据需求分析和设计对游戏的主要功能模块进行具体实现并对其进行相应测试。

本课题实现了用户名登录系统,多种不同飞机的选择让游戏玩法更加多样。游戏中也实现了火力提升系统和游戏难度提升系统,累计计分的选择让游戏更加富有挑战性,游戏最后显示的排行榜也增加了不同用户之间的竞争性。游戏中的存读档系统以及暂停系统也让游戏玩法更加灵活方便。

关键词:Python;SDL;Pygame;游戏开发

Design and implementation of aircraft combat game based on pygame2d game development framework

Abstract

PyGame is a special game library for Python language based on SDL (simple DirectMedia layer) library. SDL is a cross platform C library, which is equivalent to DirectX. In recent years, it has been used in the development of hundreds of commercial and open source games.This topic aims to study the development method of Python application, and practice the development and design process of 2D game from the design, development, testing and other aspects of the game.

The topic will start from the analysis of game requirements, and analyze the functional requirements of each game module by module. Secondly, through the flow chart of the game process for the overall outline design. After that, we use E-R diagram to design the entity relationship before the internal data of the game, and design the database in the game in detail. Then according to the demand analysis and design, the main function modules of the game are implemented and tested.

This topic has realized the user name login system, a variety of different aircraft choice, let the game play more diverse. In the game, the firepower improvement system and the game difficulty improvement system are also implemented. The choice of cumulative scoring makes the game more challenging, and the final ranking of the game also increases the competition among different users. The game"s archiving, file reading and pause system also makes the game more flexible and convenient.

Keywords:PythonSDL;Pygame;Game development


目录

摘 要 I

Abstract II

第一章 绪论 1

1.1 选题背景 1

1.1.1 系统开发背景 1

1.1.2 国内现状 1

1.2选题意义 2

1.3本章小结 2

第二章 系统开发环境及相关技术 3

2.1系统开发环境 3

2.2 Python语言 3

2.3 PyCharm 3

2.4 MySQL数据库 3

2.5 Pygame 3

2.6 Pygame2D游戏开发流程 4

2.7 本章小结 4

第三章 需求分析 6

3.1 系统需求分析 6

3.1.1操控界面需求 6

3.1.2 游戏主要功能需求 6

3.1.4 排行榜功能需求 7

3.2 本章小结 7

第四章 系统设计 8

4.1游戏流程设计 8

4.2系统实体关系设计 9

4.2.1 实体对象设计 9

4.2.2 实体关系 12

4.3关系数据模式设计 12

4.4程序结构设计 14

4.5 界面设计 14

4.6 游戏主要功能设计 15

4.7 排行榜功能设计 16

4.8 本章小结 16

第五章 系统功能的具体实现与测试 17

5.1系统开发环境部署 17

5.1.1环境变量 17

5.1.2 MySQL启动 17

5.1.3 导入所需类库 18

5.2系统核心功能实现及测试 19

5.2.1游戏主要循环功能实现 19

5.2.2事件监听功能实现 21

5.2.3 碰撞检测功能实现 22

5.2.4 暂停功能实现 23

5.3系统边缘功能实现 25

5.3.1玩家登录功能实现 25

5.3.2游戏开始界面按钮选择功能实现 26

5.3.3 存档功能实现 27

5.3.4游戏开始选择功能实现 27

5.3.5排行榜功能实现 29

5.4本章小结 30

第六章 总结与展望 31

致谢 32

参考文献(References) 33

第一章 绪论

1.1 选题背景

1.1.1 系统开发背景

在知识经济的年代,社会逐渐发展为信息社会。关于飞机大战游戏的开发,最近的文献中有陆嘉诚利用用面向对象以及面向过程的方法以 Pygame模块对飞机大战小游戏进行了二次开发。[8] 瞿苏则采用面向对象编程思想,使用 Python 语言实现了飞机大战游戏。

当今以游戏为代表的电子娱乐正成为新的主流娱乐方式。计算机技术的发展伴随着时代的发展,已经涉及到现代大部分行业。到如今复杂纷繁的游戏软件比比皆是,无论是2D平面游戏还是3D立体游戏,都是由单机游戏孕育而来。因此学习单机游戏的制作,有利于初学者了解游戏制作的理念。目前游戏产业正蒸蒸日上,如雨后春笋一般在国内和世界蓬勃发展。时至今日,网络游戏已经成为一部分人休闲娱乐的主要方式。大量海外游戏进入中国市场,国内网易腾讯等老牌公司竞争激烈,新进公司如米哈游,鹰角网络也在蓬勃发展。百花齐放的公司将国产游戏打入国际市场,随着经济的进一步发展,这一现象将愈演愈烈。

1.1.2 国内现状

Python也经常混搭HTML/CSS,Bash/Shell,SQL,C/C 和Java一起使用。Python用于数据分析比用于Web开发更广泛,数据分析占比非常大。

剩余内容已隐藏,请支付后下载全文,论文总字数:17786字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;