示例#1
0
    def calculate_movement(self, game_state: GameState) -> GameState:
        """Calculates movement for all game objects in the game state"""
        '# Calculate ships movements'
        game_state.my_ship = self.calculate_ship_movement(game_state.my_ship)
        game_state.enemy_ship = self.calculate_ship_movement(
            game_state.enemy_ship)

        '# Calculate movement for asteroids and for bullets'
        for i in game_state.asteroids:
            i.pos += i.pos_delta * self.renderPace
            i.pos = self.calculate_wrap(i.pos)
        for i in game_state.bullets:
            i.pos += i.pos_delta * self.renderPace
            i.pos = self.calculate_wrap(i.pos)

        return game_state