Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Collision Dectection - !!!AGAIN!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Canned




PostPosted: Sat Nov 24, 2007 12:46 pm   Post subject: Collision Dectection - !!!AGAIN!!!

Ok, I got it to work so that when they collide:
code:
            ___   ___
           | B | | R |
            ???   ???

they dont go through each other. Yet when I go to push from the other side:
code:
            ___   ___
           | R | | B |
            ???   ???

they just switch places.
So I wrote this to try and stop it:

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 all it did was make it so they keep pushing each other away.. I have no control over it. Any help?
Sponsor
Sponsor
Sponsor
sponsor
isaiahk9




PostPosted: Mon May 05, 2008 5:53 pm   Post subject: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: