资源简介
python编写,主要用到的python库有pygame库、tkinter库、pymsql库。压缩包已包含所有资源。实现功能:游戏用户登陆、注册,游戏数据保存,碰撞爆炸特效,飞机飞行特效,子弹追踪效果等。为之前上传的飞机大战的延申。同时运行游戏需要安装MySQL。

代码片段和文件信息
from pygame.locals import *
import itertools sys time random math pygame
from MyLibrary import *
‘‘‘ 爆炸特效 ‘‘‘
class Boom(MySprite):
def __init__(self):
MySprite.__init__(self)
self.frame=7
self.L1=False
self.L2=False
self.Kill=False
#爆炸音效
self.soundPlayOne=True
self.sound = pygame.mixer.Sound(‘Moorhuhn Kart 2_aigei_com.wav‘)
self.sound.set_volume(1.0)
def update(self current_time rate=30):
if self.soundPlayOne:
self.sound.play()
self.soundPlayOne=False
#update animation frame number
if current_time > self.last_time + rate:
self.frame += 1
if self.frame > self.last_frame:
self.frame = 4
self.L1=True
if self.frame>7 and self.L1:
self.frame=0
self.L2=True
if self.frame>3 and self.L2:
self.Kill=True
self.frame=3
self.last_time = current_time
#build current frame only if it changed
if self.frame != self.old_frame:
frame_x = (self.frame % self.columns) * self.frame_width
frame_y = (self.frame // self.columns) * self.frame_height
rect = Rect(frame_x frame_y self.frame_width self.frame_height)
self.image = self.master_image.subsurface(rect)
self.old_frame = self.frame
‘‘‘
pygame.init()
screen = pygame.display.set_mode((600600)032)
pygame.display.set_caption(“爆炸“)
font = pygame.font.Font(None 18)
framerate = pygame.time.Clock()
boom=Boom()
boom.load(‘explosion_aigei_com.png‘1281704)
boom.position=250250
boom_group=pygame.sprite.Group()
boom_group.add(boom)
while True:
framerate.tick(20)
ticks = pygame.time.get_ticks()
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
exit()
screen.fill((255255255))
for b in boom_group:
if b.Kill:
boom_group.remove(b)
boom_group.update(ticks)
boom_group.draw(screen)
pygame.display.update()
‘‘‘
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-03-30 21:55 NewPlane\__pycache__\
文件 1497 2019-03-30 21:55 NewPlane\__pycache__\boom.cpython-35.pyc
文件 1526 2019-03-30 21:55 NewPlane\__pycache__\bullet_food.cpython-35.pyc
文件 1750 2019-03-30 21:55 NewPlane\__pycache__\bulletSprite.cpython-35.pyc
文件 310 2019-03-30 21:55 NewPlane\__pycache__\constants.cpython-35.pyc
文件 2043 2019-03-30 21:55 NewPlane\__pycache__\diJi.cpython-35.pyc
文件 4133 2019-03-20 15:51 NewPlane\__pycache__\MyLibrary.cpython-35.pyc
文件 1085 2019-03-30 21:55 NewPlane\__pycache__\pla
文件 1489 2019-03-30 21:55 NewPlane\__pycache__\spritesheet_functions.cpython-35.pyc
文件 1935 2019-03-30 21:55 NewPlane\__pycache__\Track_bullet.cpython-35.pyc
文件 44524 2014-01-01 14:25 NewPlane\bg.jpg
文件 24406 2019-03-23 16:22 NewPlane\bg1.jpg
文件 139599 2019-03-23 16:26 NewPlane\bg2.jpg
文件 108884 2019-03-26 20:59 NewPlane\bg4.jpg
文件 1240660 2019-03-29 22:46 NewPlane\bg5.jpg
文件 1239061 2019-03-29 23:01 NewPlane\bg6.jpg
文件 987634 2019-03-29 23:03 NewPlane\bg7.jpg
文件 832219 2017-09-03 13:56 NewPlane\bgmusic.mp3
文件 2264 2019-03-20 16:46 NewPlane\boom.py
文件 45999 2018-11-05 19:40 NewPlane\boom_aigei_com.png
文件 7595 2018-11-05 20:00 NewPlane\boom1_aigei_com.png
文件 23131 2014-08-23 15:12 NewPlane\bullet.png
文件 1810 2019-03-27 20:38 NewPlane\bullet_food.py
文件 2117 2019-03-26 19:54 NewPlane\bullet0.png
文件 4662 2019-03-26 19:59 NewPlane\bullet1.png
文件 498 2014-08-23 15:12 NewPlane\bullet2.png
文件 315 2019-03-21 20:43 NewPlane\bullet3.png
文件 376 2019-03-21 20:44 NewPlane\bullet4.png
文件 261 2019-03-21 20:45 NewPlane\bullet5.png
文件 286 2019-03-22 16:50 NewPlane\bullet6.png
文件 3460 2019-03-26 20:13 NewPlane\bullet7.png
............此处省略38个文件信息
相关资源
- 易语言python支持库
- Python-BDD100K大规模多样化驾驶视频数据
- Instant Pygame for Python Game Development How
- Biopython Tutorial
- Think Python 2nd
- 一个小小的表白程序(python)
- Python课堂笔记(高淇400集第一季)
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
评论
共有 条评论