Fabian_Russ
Newcomer
- Joined
- Sep 29, 2008
- Messages
- 23
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?
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?