|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#附上补给模块代码
import pygame
from random import *
#超级子弹补给
class Bullet_Supply(pygame.sprite.Sprite):
def __init__(self,bg_size):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load("images/bullet_supply.png").convert_alpha()
self.rect = self.image.get_rect()
self.width,self.height = bg_size[0], bg_size[1]
self.rect.left,self.rect.bottom = randint(0,self.width - self.rect.width),-100
self.speed = 5
self.active = False
self.mask = pygame.mask.from_surface(self.image)
def move(self):
if self.rect.top < self.height:
self.rect.top += self.speed
else:
self.active = False
def reset(self):
self.active = True
self.rect.left, self.rect.bottom = randint(0, self.width - self.rect.width),-100
class Bomb_Supply(pygame.sprite.Sprite):
def __init__(self, bg_size):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load("images/bomb_supply.png").convert_alpha()
self.rect = self.image.get_rect()
self.width, self.height = bg_size[0], bg_size[1]
self.rect.left,self.rect.bottom = randint(0,self.width - self.rect.width),100
self.speed = 5
self.active = False
self.mask = pygame.mask.from_surface(self.image)
def move(self):
if self.rect.top < self.height:
self.rect.top += self.speed
else:
self.active = False
def reset(self):
self.rect.left,self.rect.bottom = randint(-36, self.width - self.rect.width), -100
self.active = True |
|