Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I got my physics to work.

I have a question tho.

 

Sub CheckForCollision()

If Picturebox1.Bounds.IntersectsWith(Picturebox2.Bounds) = True Then

If Picturebox1.Bounds.Top = Picturebox2.Bounds.Bottom - 1 Then

Collision = 1

End If

End If

 

If Picturebox1.Bounds.Left = Picturebox2.Bounds.Right - 2 Then

Collision = 2

End If

If Picturebox1.Bounds.Right = Picturebox2.Bounds.Left + 1 Then

Collision = 3

End If

If Picturebox1.Bounds.Bottom = Picturebox2.Bounds.Top + 1 Then

Collision = 4

End If

If Picturebox1.Bounds.IntersectsWith(Picturebox1.Bounds) = False Then

Collision = 0

End If

 

Picturebox1 is my player

Picturebox2 is a building.

Is there anyway to not have to code this huge code for everything in the form?

Like, Every Item that I have gives out a True or False Statement? Can I make that True or False Statement tell if it needs to set the physics?

OR Will I have to keep entering in that same code for every object in the game?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...