摘要
《坦克大战-1990》是一款坦克为题材的平面射击小游戏,游戏目标是消灭敌对坦克,保护领地。游戏使用Python以及强大的第三方库Pygame, Pygame是跨平台Python模块,专为电子游戏设计,包含图像、声音,可以用Pygame绘制图形,执行动画以及使用定时器让游戏按照稳定的帧速率运行,提供很多游戏界面,游戏元素显示的函数,让开发者专注于考虑游戏的逻辑,从而降低了在游戏界面上开发的难度。整个游戏主要基于Pygame库进行开发,各模块均用函数进行封装,以增强复用性,利用Pygame模块设计了炮弹,坦克类的相关方法和属性,进行了背景贴图,实现了坦克大战游戏的功能。
关键字:坦克大战、Python、Pygame
Abstract
"Tank war-1990" is a small plane shooting game with tank as the theme. The goal of the game is to eliminate enemy tanks and protect territory. The game uses Python and a powerful third-party library pyGame, PyGame is a cross platform Python module designed for electronic games, including images and sounds. PyGame can be used to draw graphics, execute animations and use timers to make the game run at a stable frame rate. It provides many game interfaces and functions for displaying game elements, which enables developers to focus on the logic of the game, thus reducing the difficulty of developing on the game interface. The game uses pyGame module to design bullet, tank class related methods and attributes, and carries out background mapping to realize the function of tank war game.
Keywords: tank war, Python, Pygame
第1章 引言
1.1 研究的背景及意义
在社会经济发展迅速,人们的工作压力越来越来,长时间紧张繁忙的工作压力使人们精神紧绷,为了更好的工作并提高工作效率,这时间就需要短暂的休息让紧绷的精神放松一下。缓解压力的方式也很多,要选择适合自己的方式,玩游戏也是众多缓解压力方式之一。看电影、电视或者音乐也可以缓解压力,但是人们只是能被动的观看与倾听,并不能参与其中进行互动。而游戏有着很好交互性,玩家并不是仅仅在观看角色在如何移动,而是也要融入角色当中进行操作。在游戏中,玩家的行为也会对游戏产生影响。游戏除了让人娱乐之外还可以作为缓解压力的方式,在休息的时候可以不用想其他事情,这样压力就会得到缓解。
1.2 研究目的
主要目的锻炼面相对象编程思想,掌握基本的python程序编写、编译与运行程序的方法,同时在学习Python进行游戏编写时学习Pygame模块,进一步提高逻辑思维能力、动手能力、独立解决问题能力和学习新技术的能力。
1.3 国内外的发展现状
个人计算机刚刚开始普及的时候,游戏并不能被广泛接受,最主要的原因就是不能充分发挥个人计算机的性能,游戏程序不能最大化使用PC机器的硬件资源,机器与人的交互做的还不够好。由此导致个人计算机早起游戏画面差,操作感僵硬,可玩性不高,所以不被