Fabian_Russ Posted September 30, 2008 Posted September 30, 2008 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? Quote
Administrators PlausiblyDamp Posted October 1, 2008 Administrators Posted October 1, 2008 You might be better avoiding pictureboxes, and just use GDI / GDI+ to render the sprites. http://www.xtremedotnettalk.com/showthread.php?t=72746 http://www.xtremedotnettalk.com/showthread.php?t=90455 might be worth a glance as they cover similar issues. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.