Пример #1
0
    def test_rocket_ship_collision(self):
        rocket = Rocket(Vec2D(200, 100), Vec2D(10, 10))
        self.world.check_rocket_movable_collisions(rocket)
        self.assertTrue(self.world.ship.alive)

        rocket.pos = Vec2D(100, 100)
        self.world.check_rocket_movable_collisions(rocket)
        self.assertFalse(self.world.ship.alive)
Пример #2
0
    def test_rocket_ground_collision(self):
        rocket = Rocket(Vec2D(100, 100), Vec2D(10, 10))
        self.world.check_rocket_ground_collisions(rocket)
        self.assertTrue(rocket.alive)
        self.assertEqual(0, len(self.world.events))

        rocket.pos = Vec2D(200, 50)
        self.world.check_rocket_ground_collisions(rocket)
        self.assertFalse(rocket.alive)
        self.assertEqual(1, len(self.world.events))