• 大小: 71.29MB
    文件类型: .rar
    金币: 2
    下载: 2 次
    发布日期: 2022-01-29
  • 语言: Python
  • 标签: 游戏源码  pygame  

资源简介

python pygame全民大战飞机游戏源码python pygame全民大战飞机游戏源码

资源截图

代码片段和文件信息

from random import *
import pygame

class Back(pygame.sprite.Sprite):
    def __init__(selfpositionbg_size):
        pygame.sprite.Sprite.__init__(self)

        self.widthself.height = bg_size[0]bg_size[1]

                #设置子弹对象
        self.image = pygame.image.load(‘image/aircraft_image/image_1.jpg‘).convert_alpha()
        self.images = []
        self.images.extend([\
                pygame.image.load(‘image/aircraft_image/image_2.jpg‘).convert_alpha()\
                pygame.image.load(‘image/aircraft_image/image_3.jpg‘).convert_alpha()\
                pygame.image.load(‘image/aircraft_image/image_4.jpg‘).convert_alpha()\
                pygame.image.load(‘image/aircraft_image/image_5.jpg‘).convert_alpha()
            
            ])

        self.rect = self.image.get_rect()
        self.rect.leftself.rect.bottom = position
        self.speed = 1
        self.action = False
        




    def move(self):
        self.rect.top+=self.speed
            
        if self.rect.bottom>self.height:
                self.action = True

            

            

        
        
                
            
            
            



        





class Ground(pygame.sprite.Sprite):
    def __init__(selfbg_size):
        pygame.sprite.Sprite.__init__(self)

        
        self.image = pygame.image.load(‘image/aircraft_image/img_cloud_1.png‘).convert_alpha()
        self.images = pygame.image.load(‘image/aircraft_image/img_cloud_2.png‘).convert_alpha()
        self.image_s = choice([self.imageself.images])
        self.image_rect = self.image_s.get_rect()
        self.widthself.height = bg_size[0]bg_size[1]
        self.image_rect.leftself.image_rect.bottom = choice([(self.width-self.image_rect.width//2)(0-self.image_rect.width//2)])\
                                                      randint(-50-10)
        self.speed = 1


        
    def move(self):                
            if self.image_rect.top < self.height:
                    self.image_rect.top+=1
            else:
                self.reset()
    def reset(self):
            
            self.image_s = choice([self.imageself.images])
            self.image_rect = self.image_s.get_rect()
            self.image_rect.leftself.image_rect.bottom = randint(0-self.image_rect.width//2self.width-self.image_rect.width//2)\
                                                       randint(-50-10)
    

            

                                                           
                                        






        
        
            
        
        
    


                






        


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     134063  2016-12-19 19:44  全民大战飞机\audio\bgm_cunshiqujinbi.mp3

     文件     370419  2016-12-19 19:44  全民大战飞机\audio\bgm_dfzhandou.mp3

     文件     388287  2016-12-19 19:44  全民大战飞机\audio\bgm_jizhanboss1.mp3

     文件     359448  2016-12-19 19:44  全民大战飞机\audio\bgm_jizhanboss2.mp3

     文件     380763  2016-12-19 19:44  全民大战飞机\audio\bgm_jizhanboss3.mp3

     文件     198011  2016-12-19 19:44  全民大战飞机\audio\bgm_siwangchongci.mp3

     文件     153185  2016-12-19 19:44  全民大战飞机\audio\bgm_tiaoguanchongci.mp3

     文件     749403  2016-12-19 19:44  全民大战飞机\audio\bgm_zhandou1.mp3

     文件     622448  2016-12-19 19:44  全民大战飞机\audio\bgm_zhandou2.mp3

     文件    9133148  2016-12-19 19:44  全民大战飞机\audio\bgm_zhandou2.wav

     文件     386406  2016-12-19 19:44  全民大战飞机\audio\bgm_zhandou3.mp3

     文件     766017  2016-12-19 19:44  全民大战飞机\audio\bgm_zhuxuanlv.mp3

     文件    1387969  2016-12-19 19:44  全民大战飞机\audio\bgm_zhuxuanlv.ogg

     文件      77012  2016-12-19 19:44  全民大战飞机\audio\bg_logobg.mp3

     文件       6168  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_beiji.mp3

     文件      16512  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_bossfashezidan1.mp3

     文件      19960  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_bossjiesuan.mp3

     文件       6168  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_chihuoyanzidan.mp3

     文件       6794  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_chihuzhao.mp3

     文件       4914  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_chijiguangzidan.mp3

     文件       5227  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_chijinbi.mp3

     文件      10870  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_chijinbi1.mp3

     文件      10870  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_chijinbi2.mp3

     文件      10870  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_chijinbi3.mp3

     文件       8048  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_chilvbaoshi.mp3

     文件       8048  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_chizuanshi.mp3

     文件      73563  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_chongci.mp3

     文件       8989  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_citie.mp3

     文件      25916  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_dabaozha.mp3

     文件      25289  2016-12-19 19:44  全民大战飞机\audio\effcet_sfx_dai.mp3

............此处省略1376个文件信息

评论

共有 条评论