资源简介
使用python编写的打飞机游戏源码,可以直接运行,包含计分,碰撞检测,爆炸等效果

代码片段和文件信息
import pygame
import settings
from ship import Ship
from enemy import Enemy
import game_function as gf
from pygame.sprite import Group
from game_stats import GameStats
from button import Button
from boom import Boom
from time import sleep
from scoreboard import Scoreboard
def run_game():
#init game and screen
pygame.init()
game_settings = settings.Settings()
screen = pygame.display.set_mode((game_settings.screen_width game_settings.screen_height))
pygame.display.set_caption(‘Plane‘)
ship = Ship(game_settings screen)
bullets = Group()
enemys = Group()
booms = Group()
gf.create_enemys(game_settings screen enemys ship)
stats = GameStats(game_settings)
try:
with open(“./score.txt“ “r“) as file_score:
stats.high_score = int(file_score.read())
except FileNotFoundError:
pass
play_button = Button(game_settings screen “Play“)
score = Scoreboard(screen game_settings stats)
while True:
gf.check_events(game_settings stats screen ship bullets enemys booms play_button score)
if stats.game_active:
ship.update()
gf.update_bullets(game_settings stats screen bullets enemys booms ship score)
gf.update_enemys(game_settings screen enemys ship bullets stats score)
gf.update_screen(game_settings stats screen ship bullets enemys booms play_button score)
if __name__ == ‘__main__‘:
run_game()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1532 2017-11-25 11:42 Alien\Alien\Alien.py
文件 2653 2017-11-25 10:07 Alien\Alien\Alien.pyproj
文件 786 2017-11-24 17:25 Alien\Alien\Alien.spec
文件 475 2017-11-24 18:15 Alien\Alien\boom.py
文件 748 2017-11-23 11:37 Alien\Alien\bullet.py
文件 901 2017-11-25 10:04 Alien\Alien\button.py
文件 1085 2017-11-25 09:35 Alien\Alien\enemy.py
文件 7325 2017-11-25 11:41 Alien\Alien\game_function.py
文件 410 2017-11-25 10:37 Alien\Alien\game_stats.py
文件 3126 2017-11-24 17:48 Alien\Alien\images\boom.bmp
文件 3126 2017-11-23 14:06 Alien\Alien\images\enemy.bmp
文件 3126 2017-11-23 14:06 Alien\Alien\images\ship.bmp
文件 3 2017-11-25 11:45 Alien\Alien\score.txt
文件 2544 2017-11-25 11:43 Alien\Alien\scoreboard.py
文件 1000 2017-11-25 11:46 Alien\Alien\settings.py
文件 1329 2017-11-25 11:02 Alien\Alien\ship.py
文件 1080 2017-11-24 17:21 Alien\Alien\__pycache__\Alien.cpython-36.pyc
文件 894 2017-11-24 18:15 Alien\Alien\__pycache__\boom.cpython-36.pyc
文件 1161 2017-11-23 11:45 Alien\Alien\__pycache__\bullet.cpython-36.pyc
文件 1221 2017-11-25 10:07 Alien\Alien\__pycache__\button.cpython-36.pyc
文件 1335 2017-11-25 09:35 Alien\Alien\__pycache__\enemy.cpython-36.pyc
文件 6136 2017-11-25 11:41 Alien\Alien\__pycache__\game_function.cpython-36.pyc
文件 797 2017-11-25 10:41 Alien\Alien\__pycache__\game_stats.cpython-36.pyc
文件 2719 2017-11-25 11:43 Alien\Alien\__pycache__\scoreboard.cpython-36.pyc
文件 1307 2017-11-25 11:33 Alien\Alien\__pycache__\settings.cpython-36.pyc
文件 1471 2017-11-25 11:11 Alien\Alien\__pycache__\ship.cpython-36.pyc
文件 741 2017-11-22 14:04 Alien\Alien.sln
..A..H. 19456 2017-11-25 10:10 Alien\Alien.suo
目录 0 2017-11-24 17:24 Alien\Alien\build\Alien
目录 0 2017-11-24 17:24 Alien\Alien\build
............此处省略8个文件信息
相关资源
- 二级考试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管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
- python获取硬件信息
评论
共有 条评论