def setup_textobjs(self): self.scoretxt = TextObj(text='Score:', color=(255, 255, 255), size=18) self.scorenum = TextObj(text=publish_with_results('give', 'last_score')[0], color=(255, 255, 255), size=18) self.livestxt = TextObj(text='Lives:', color=(255, 255, 255), size=18) self.livesnum = TextObj(text=publish_with_results('give', 'last_lives')[0], color=(255, 255, 255), size=18) self.leveltxt = TextObj(text='', color=(255, 255, 255), size=18) self.gameovertxt = TextObj(text=' '.join("GAME OVER"), size=36) #set locations for all objects self.scoretxt.pin_at('topleft', (15, 15)) self.scorenum.pin_at('topleft', (self.scoretxt.rect.topright[0] + 5, self.scoretxt.rect.topright[1])) self.livestxt.pin_at('topright', (self.w - (self.w / 19), 15)) self.livesnum.pin_at('topleft', (self.livestxt.rect.topright[0] + 5, self.livestxt.rect.topright[1])) self.leveltxt.pin_at('center', (self.w / 2, self.h / 20)) self.gameovertxt.pin_at('center', (self.w / 2, self.h / 2)) self.gameovertxt.hide()
def __init__(self): super(GameOverScene, self).__init__() self.state = "build_scores" self.player_initials = "" self.ship_score = publish_with_results("give", "last_score")[0] or 0 self.get_score_q = pygame.sprite.Group() self.show_scores_q = pygame.sprite.Group() self.setup_txtobjs()