def init(self, App): BaseGame.init(self, App) self.screen = self.app.screen self.font = pygame.font.Font("../media/font/VeraMono.ttf", 20) self.players = None register_event(KEYDOWN, self.open_help, K_h) self.draw_select_player_screen()
def init(self, App): BaseGame.init(self, App) self.whales = pygame.sprite.Group() self.entities = pygame.sprite.Group() self.modifiers = pygame.sprite.Group() self.projectiles = pygame.sprite.Group() self.groups = [self.whales, self.entities, self.modifiers, self.projectiles] self.enemies = pygame.sprite.Group() self.ocean = pygame.Surface(App.screen.get_size()) self.ocean.fill((0,0,200)) self.create_whales()
def __getattribute__(self, name): """Intercept all observer notifications for functions named on*() and store the arguments.""" if name.startswith('on'): def onCallback(*args): self.calls[name] = args return BaseGame.__getattribute__(self, name)(*args) return onCallback return BaseGame.__getattribute__(self, name)
def init(self, App): BaseGame.init(self, App) self.screen = self.app.screen self.font = pygame.font.Font("../media/font/VeraMono.ttf", 20) self.draw_help_screen()
def onCallback(*args): self.calls[name] = args return BaseGame.__getattribute__(self, name)(*args)
def __init__(self, players = 2): BaseGame.__init__(self) self.players = players self.game_over = False self.score = 0 self.font = pygame.font.Font("../media/font/VeraMono.ttf", 20)