Example #1
0
    def test_enfoldingcollision(self):
        def step():
            s1.x += 1
            s2.x -= 1
            c = s1.collidingWith(s2)
            self.assertTrue(c, msg="big sprite colliding with embedded sprite")
            c = s2.collidingWith(s1)
            self.assertTrue(c,
                            msg="small sprite colliding with enfolding sprite")

        s1 = Sprite(self.rocket, (10, 10))
        s2 = Sprite(self.image, (15, 15))

        a = App()
        a.run(step)

        for i in range(10):
            a._animate(1)

        s1.destroy()
        s2.destroy()