Computer Science Canada

Collision Detection - AGAIN

Author:  Canned [ Sat Nov 24, 2007 12:53 pm ]
Post subject:  Collision Detection - AGAIN

I got it so when I bump infront, they dont go through each other. Yet when I go to bump from behind, They literally swap places. So I wrote this code to stop it from doing that:
code:
if x1 > x4 and x3 < x2 and y4 < y1 and y3 < y2 then
        x1 := x1 + 5
        x2 := x2 + 5
        x3 := x3 - 5
        x4 := x4 - 5
    end if

and when I go to bump from behind, they push away from each other, and I cant stop it. Any help?


: