Jump to content

Colisao de objetos


Retsu9
 Share

Recommended Posts

se for um quadrado ou rectangulo a classe rectangle faz isso por ti..

	    Dim rect As Rectangle = New Rectangle(100, 100, 100, 100)

    Dim rect2 As Rectangle = New Rectangle(50, 50, 100, 100)

    If rect.IntersectsWith(rect2) Then MsgBox("ta dentro")

se for circulos dá para usar o teorema de pitagoras, o centro dos dois circulos sao as pontas das hipotenusa, se a soma dos raios dos 2 circulos forem menor que a hipotenusa é porque estão a colidir...

Link to comment
Share on other sites

o mais facil seria passar o X, Y, width e height ou a location e size das picturesbox's para o exemplo que dei em cima.... mas tambem podes fazer com if's...

Dim rect As Rectangle = New Rectangle(PictureBox1.Location, PictureBox1.Size)

era isso mesmo, obrigado

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.