资源简介

用python中的pygame模块所写的飞机大战游戏,以及资源。 包括代码,游戏运行的音效,图片。可直接运行

资源截图

代码片段和文件信息

#!/usr/bin/env python
# coding: utf-8

# In[1]:


import pygame
class Bullet1(pygame.sprite.Sprite):
    def __init__(selfposition):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load(“images/bullet1.png“).convert_alpha()
        self.rect = self.image.get_rect()
        self.rect.leftself.rect.top = position
        self.speed = 12
        self.active = False
        self.mask = pygame.mask.from_surface(self.image)
    def move(self):
        self.rect.top -= self.speed
        if self.rect.top<0:
            self.active = False
    def reset(selfposition):
        self.rect.leftself.rect.top = position
        self.active = True

class Bullet2(pygame.sprite.Sprite):
    def __init__(selfposition):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load(“images/bullet2.png“).convert_alpha()
        self.rect = self.image.get_rect()
        self.rect.leftself.rect.top = position
        self.speed = 14
        self.active = False
        self.mask = pygame.mask.from_surface(self.image)
    def move(self):
        self.rect.top -= self.speed
        if self.rect.top<0:
            self.active = False
    def reset(selfposition):
        self.rect.leftself.rect.top = position
        self.active = True


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-02-02 22:45  aircraft battle\.ipynb_checkpoints\
     文件        2297  2020-02-02 16:15  aircraft battle\.ipynb_checkpoints\bullet-checkpoint.ipynb
     文件        5835  2020-02-01 21:05  aircraft battle\.ipynb_checkpoints\enemy-checkpoint.ipynb
     文件       23209  2020-02-02 22:34  aircraft battle\.ipynb_checkpoints\main-checkpoint.ipynb
     文件        2996  2020-02-02 19:37  aircraft battle\.ipynb_checkpoints\myplane-checkpoint.ipynb
     文件        2532  2020-02-02 14:53  aircraft battle\.ipynb_checkpoints\supply-checkpoint.ipynb
     目录           0  2020-02-02 22:45  aircraft battle\__pycache__\
     文件        1771  2020-02-02 16:16  aircraft battle\__pycache__\bullet.cpython-37.pyc
     文件        3986  2020-02-01 21:16  aircraft battle\__pycache__\enemy.cpython-37.pyc
     文件        1994  2020-02-02 20:29  aircraft battle\__pycache__\myplane.cpython-37.pyc
     文件        2073  2020-02-02 14:54  aircraft battle\__pycache__\supply.cpython-37.pyc
     文件        2297  2020-02-02 16:15  aircraft battle\bullet.ipynb
     文件        1288  2020-02-02 16:15  aircraft battle\bullet.py
     文件        5843  2020-02-01 21:10  aircraft battle\enemy.ipynb
     文件        4465  2020-02-01 21:12  aircraft battle\enemy.py
     目录           0  2020-02-02 22:45  aircraft battle\font\
     文件       78500  2015-07-24 18:05  aircraft battle\font\font.ttf
     目录           0  2020-02-02 22:45  aircraft battle\images\
     文件        4088  2018-12-21 20:35  aircraft battle\images\again.png
     文件       38589  2018-12-21 20:35  aircraft battle\images\background.png
     文件        5641  2018-12-21 20:35  aircraft battle\images\bomb.png
     文件        7609  2018-12-21 20:35  aircraft battle\images\bomb_supply.png
     文件        7153  2018-12-21 20:35  aircraft battle\images\bullet_supply.png
     文件         292  2018-12-21 20:35  aircraft battle\images\bullet1.png
     文件         289  2018-12-21 20:35  aircraft battle\images\bullet2.png
     文件        3232  2018-12-21 20:51  aircraft battle\images\enemy1.png
     文件        3469  2018-12-21 20:35  aircraft battle\images\enemy1_down1.png
     文件        3932  2018-12-21 20:35  aircraft battle\images\enemy1_down2.png
     文件        5287  2018-12-21 20:35  aircraft battle\images\enemy1_down3.png
     文件        2040  2018-12-21 20:35  aircraft battle\images\enemy1_down4.png
     文件        7864  2018-12-21 20:35  aircraft battle\images\enemy2.png
............此处省略46个文件信息

评论

共有 条评论