visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: Java :: collision code in VB6?


By: VB guy Canada  Date: 05/09/2003 00:00:00  English  Points: 90 Status: Answered
Quality : Excellent
i am trying to make a game where numerous buttons drop from the top of a form and you have 1 "main" button
that follows the cursor anywhere on the form and is used to bounce the other buttons back to the top of the form
when the bottom of the falling button hits the top of the main button.

but i can't seem to figure out how to get the button to "collide" with the main buttons top.

thhis is as good as i can get it, being a newbie

any help will be appreciated
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Move X, Y

End Sub

Private Sub Timer1_Timer()
Command2.Top = Command2.Top + 100
If Command2.Top > Command1.Top Then
Command2.Top = 0
End If
End Sub
------------------------------------------------------------------------------------------------------------------------------------------------------------------

By: VGR Date: 06/09/2003 18:40:00 English  Type : Answer
well, if the colliding region (one button) has a rectangular shape, then the test for collision could be to test for "at least a corner is inside" the colliding region

ie something like this :

if ( ((y<=top) and (y>=bottom)) and ((x>=left)AND(x<=right)) // that's for upper left corner (x,y)
OR ((y<=top) and (y>=bottom)) and ((x>=left)AND(x<=right)) // that's for upper right corner (x,y)
OR ((y<=top) and (y>=bottom)) and ((x>=left)AND(x<=right)) // idem bottom left (x,y)
OR ((y<=top) and (y>=bottom)) and ((x>=left)AND(x<=right)) // idem bottom right (x,y)
) then collision
By: k_rupa Date: 07/09/2003 20:21:00 English  Type : Assist
to collide the top of main button with bottom of falling button , u have to write in if condition

if( fallingbutton.top +fallingbutton.height ==mainbutton.top-10)

{


}








Do register to be able to answer

EContact
browser fav
page generated in 106.422900 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page