Unreal
Jan 27th, 2000, 08:50 AM
How do i make it so if a shape on screen hits another on screen shape, a message box would appear and say "oops!"?
Fox
Jan 30th, 2000, 05:25 AM
Well, I think the easiest way of collision is a square-detection. Try this:
-
'Enemy and Shot are the two objects to check
'Collision from top-left
If Shot.Left + Shot.Width > Enemy.Left Then
If Shot.Top + Shot.Height > Enemy.Top Then
'Collision from bottom-right
If Shot.Left < Enemy.Left + Enemy.Width Then
If Shot.Top < Enemy.Top + Enemy.Height Then
'Code here
EndIf
EndIf
EndIf
EndIf
-
Of course you can take 2 if's together...
Hope this helps!
------------------
fox_mccloud@gmx.net
...
Every program can be reduced to one instruction which doesn't work.