
-----------------------------------
Canned
Sat Nov 24, 2007 12:46 pm

Collision Dectection - !!!AGAIN!!!
-----------------------------------
Ok, I got it to work so that when they collide:
            ___   ___
           | B | | R |
            ???   ???
they dont go through each other. Yet when I go to push from the other side:
            ___   ___
           | R | | B |
            ???   ???
they just switch places.
So I wrote this to try and stop it:

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 all it did was make it so they keep pushing each other away.. I have no control over it. Any help?

-----------------------------------
isaiahk9
Mon May 05, 2008 5:53 pm

Re: Collision Dectection - !!!AGAIN!!!
-----------------------------------
with this code you wrote :
if x1 > x4 and x3 < x2 and y4 < y1 and y3 < y2 then 
You're making it so that if the boxes are anywhere then they'll switch.  Instead, go like this :

if View.Whatdotcolor (x2, y1) = blue then
%red box
drawbox -5
%bluebox
drawbox + 5


that's it, i think.
