Example #1
0
 def test_col(self):
     w, h = 80, 200
     map_ = Map(w, h)
     map_.ship = Ship(Vector(40, 101), [0, 0, 0])
     map_.asteroids = [AsteroidMediumStrong(Vector(40, 40), radius=40)]
     game = Game(w, h)
     game.Map = map_  # ship делает шаг длины 2
     game.handle_collisions()
     map_.ship.update_ship_location()
     self.assertEqual(103, map_.ship.location.y)
Example #2
0
    def run_game(self):
        game = Game(self.win_params.width, self.win_params.height, self.shop)
        game.shop.reset_if_arsenal_is_empty()
        self.all_sprites = pygame.sprite.Group()
        self.add_starting_sprites(game.Map.map_objects)
        while game.running:
            game.Map.removing_objects.clear()
            game.Map.new_objects.clear()

            self.clock.tick(FPS)
            self.handle_keys_events(game)
            game.finish_if_required()
            game.handle_collisions()
            game.update()

            self.update_sprites_list(game.Map)
            self.draw(game)

        return game.get_results()