You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
862 B

import pygame
from .. import tools,setup
from .. import constants as C
def create_powerup(centerx,centery,type): # 根据状态出现道具
"""create powerup based on type and mario state"""
return Mushroom(centerx,centery)
class PowerUp(pygame.sprite.Sprite):
def __init__(self,centerx,rentery,frame_rects):
pygame.sprite.Sprite.__init__(self)
self.frames = []
self.frame_index = 0
for frame_rect in frame_rects:
self.frames.append(tools.get_image(setup.GRAPHICS['item_objects'],*frame_rect,(0,0,0),2.5))
self.image = self.frames[self.frame_index]
self.rect = self.image.get_rect()
self.rect.centerx = centerx
self.rect.centery = rentery
class Mushroom(PowerUp):
def __init__(self,centerx,centery):
PowerUp.__init__(self,centerx,centery,[(0,0,16,16)])