def test_hitbox4():
    T1 = CollideTransformable()
    T2 = CollideTransformable()
    R1 = Rect(-1, -1, 2, 2)
    R2 = Rect(-1, -1, 2, 2)
    Hb1 = Hitbox(R1)
    Hb2 = Hitbox(R2)
    Hb1.link(T1)
    Hb2.link(T2)
    T1.translate(Vector(1, 1))
    T2.translate(Vector(3, 1))
    T2.set_speed(Vector(-1, 0))
    v = Hb2.remove_collide(Hb1)
    T2.translate(v)
    assert not (Hb1.collide(Hb2))
def test_hitbox3():

    T1 = CollideTransformable()
    T2 = CollideTransformable()
    R1 = Rect(-1, -1, 2, 2)
    R2 = Rect(-1, -1, 2, 2)
    Hb1 = Hitbox(R1)
    Hb2 = Hitbox(R2)
    Hb1.link(T1)
    Hb2.link(T2)
    T1.translate(Vector(1, 1))
    T2.translate(Vector(2.5, 1))
    T1.set_speed(Vector(1, 0))
    print(Hb1.get_world_rect())
    print(Hb2.get_world_rect())
    v = Hb1.remove_collide(Hb2)
    print(v)
    T1.translate(v)
    assert not (Hb1.collide(Hb2))
def test_hitbox2():
    T1 = CollideTransformable()
    T2 = CollideTransformable()
    R1 = Rect(-1, -1, 2, 2)
    R2 = Rect(-1, -1, 2, 2)
    Hb1 = Hitbox(R1)
    Hb2 = Hitbox(R2)
    Hb1.link(T1)
    Hb2.link(T2)
    T1.translate(Vector(0.5, 0.5))
    assert Hb1.collide(Hb2)
    assert Hb2.collide(Hb1)

    T1.translate(Vector(-0.5, -0.5))
    T2.translate(Vector(2, 0))

    assert Hb1.collide(Hb1)
    assert Hb2.collide(Hb2)

    T2.translate(Vector(0.01, 0))
    assert not (Hb1.collide(Hb2))
    assert not (Hb2.collide(Hb1))