コード例 #1
0
    def update(self, delta_ms):
        from engine.game_env import Game
        left = Game.get_key(K_a) or Game.get_key(K_LEFT)
        right = Game.get_key(K_d) or Game.get_key(K_RIGHT)

        if left:
            self.rect.centerx -= int(self.x_vel * delta_ms)
        if right:
            self.rect.centerx += int(self.x_vel * delta_ms)
コード例 #2
0
 def launch_ball(self):
     from pygame.locals import K_SPACE
     from engine.game_env import Game
     if Game.get_key(K_SPACE):
         self.ball.launch()