예제 #1
0
    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()
예제 #2
0
    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()
예제 #3
0
 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)
예제 #4
0
    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)
예제 #5
0
    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()
예제 #6
0
 def onCallback(*args):
     self.calls[name] = args
     return BaseGame.__getattribute__(self, name)(*args)
예제 #7
0
 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)
예제 #8
0
 def onCallback(*args):
     self.calls[name] = args
     return BaseGame.__getattribute__(self, name)(*args)