def test_ship_can_shoot_only_once_during_reload_time(self): map_ = get_map(ship_location=Vector(40, 100)) game = Game(1, 1) game.Map = map_ game.ship.shooting = True for i in range(game.ship.current_bullet_type.RELOAD_TIME + 1): game.shoot() game.ship.reload_bullet() self.assertEqual(1, len(map_.bullets))
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)
def get_map(ship_location): w, h = 80, 200 map_ = Map(w, h) map_.ship = Ship(ship_location, { BulletFast: 50, BulletMedium: 50, BulletSlow: 50 }) game = Game(w, h) game.Map = map_ # ship делает шаг длины 2 return map_