Fragoff
Dec 6th, 2000, 03:18 PM
To my question
Hi, if I have 2 bouncing squares, bouncing around inside a larger square how do I detect when the squares hit each other? I can get some level of detection using an IF on the top and left properties of the objects but not the whole square can anyone help? I hope this makes sense!
The follwing solution was offered
--------------------------------------------------------------------------------
a=x1t<x2t'top borders
b=x1b>x2b'bottom borders
c=x1l<x2l'left borders
d=x1r>x2r'right borders
if not((a xor b) or (c xor d) or (a xor c)) then 'collision
again this works to some degree but it would appear that the borders of the sqaures need to match exactltly for collision to be detected. I wonder if my problem is that I am using picture boxes and properties thereof for my squares - any comments greatfully appreciated
Hi, if I have 2 bouncing squares, bouncing around inside a larger square how do I detect when the squares hit each other? I can get some level of detection using an IF on the top and left properties of the objects but not the whole square can anyone help? I hope this makes sense!
The follwing solution was offered
--------------------------------------------------------------------------------
a=x1t<x2t'top borders
b=x1b>x2b'bottom borders
c=x1l<x2l'left borders
d=x1r>x2r'right borders
if not((a xor b) or (c xor d) or (a xor c)) then 'collision
again this works to some degree but it would appear that the borders of the sqaures need to match exactltly for collision to be detected. I wonder if my problem is that I am using picture boxes and properties thereof for my squares - any comments greatfully appreciated