def __init__(self, row, position): surface, rect = graphic(f'explosion{_IMG_COLORS[row]}', position) surface = transform.scale(surface, (40, 35)) BasicSprite.__init__(self, surface, rect) self.start_time = 0 self.row = row self.moved = False
def __init__(self, score, position): x, y = position surface, rect = text(str(score), SpaceInvadersColor.WHITE.value, *SpaceInvadersFont.SMALL.value, position=(x + 20, y + 6)) BasicSprite.__init__(self, surface, rect) self.start_time = 600 self.row = MYSTERY_ROW
def __init__(self, game): BaseScene.__init__(self, game, active=True) self.life_text = BasicSprite( *text('Lives', SpaceInvadersColor.WHITE.value, *SpaceInvadersFont.SMALL.value, position=(640, 5))) self.life_1 = BasicSprite(*graphic('ship', position=(715, 3), scale=(23, 23))) self.life_2 = BasicSprite(*graphic('ship', position=(742, 3), scale=(23, 23))) self.life_3 = BasicSprite(*graphic('ship', position=(769, 3), scale=(23, 23)))
def __init__(self, game): BaseScene.__init__(self, game, active=True) items = [ text('Space Invaders', SpaceInvadersColor.WHITE.value, *SpaceInvadersFont.LARGE.value, position=(164, 155)), text('Press any key to continue', SpaceInvadersColor.WHITE.value, *SpaceInvadersFont.MEDIUM.value, position=(201, 225)), graphic('enemy3_1', (318, 370), (40, 40)), text(' = 10 pts', SpaceInvadersColor.GREEN.value, *SpaceInvadersFont.MEDIUM.value, position=(368, 270)), graphic('enemy2_2', (318, 320), (40, 40)), text(' = 20 pts', SpaceInvadersColor.BLUE.value, *SpaceInvadersFont.MEDIUM.value, position=(368, 320)), graphic('enemy1_2', (318, 270), (40, 40)), text(' = 30 pts', SpaceInvadersColor.PURPLE.value, *SpaceInvadersFont.MEDIUM.value, position=(368, 370)), graphic('mystery', (299, 420), (80, 40)), text(' = ?????', SpaceInvadersColor.RED.value, *SpaceInvadersFont.MEDIUM.value, position=(368, 420)) ] for item in items: self.group.add(BasicSprite(*item))
def __init__(self, game): BaseScene.__init__(self, game) self.group.add( BasicSprite(*text('Game Over', SpaceInvadersColor.WHITE.value, *SpaceInvadersFont.LARGE.value, position=(250, 270)))) self.menu_time = 0.0
def set_score(self, score): self.group.empty() self.group.add(self.score_label) self.group.add( BasicSprite(*text(str(score), SpaceInvadersColor.GREEN.value, *SpaceInvadersFont.SMALL.value, position=(85, 5))))
def __init__(self, position): surface, rect = graphic('ship', position) BasicSprite.__init__(self, surface, rect) self.start_time = 900
def __init__(self, game): BaseScene.__init__(self, game, active=True) self.score_label = BasicSprite(*text('Score', SpaceInvadersColor.WHITE.value, *SpaceInvadersFont.SMALL.value, position=(5, 5)))