
-Pwnt-
Veteran

Apr 10, 2006, 2:52 AM
Post #1 of 1
(407 views)
Shortcut
|
|
VB Animated Games
|
Can't Post
|
|
Making GAMES in VB is almost impossible for me but I made a few functions before to help myself creating 2D GAMES that involve an image moving from 1 place to another. The functions aren't even useful to anyone but the FindCollision one is really helpful. It will return true if two images are touching and will return false if not. So for example in a video game, some image of a guy could touch the image of a door. You can use FindCollision in a timer or something to make something happen when he hits the door. Here it is: (In code tags)
Function FindCollision(ImageA As Image, ImageB As Image) As Boolean '//Evaluates two images to see if they are touching. Returns true if they are If (ImageA.Top + ImageA.Height) >= ImageB.Top And (ImageA.Top) _ <= (ImageB.Height + ImageB.Top) Then If (ImageA.Left + ImageA.Width) >= ImageB.Left And (ImageA.Left) _ <= (ImageB.Width + ImageB.Left) Then FindCollision = True End If End If End Function If there are any bugs, tell me. ~ Thanks. Pwnt. <3.
“Begin doing what you want to do now. We are not living in eternity. We have only this moment, sparkling like a star in our hand - and melting like a snowflake…”
(This post was edited by -Pwnt- on Apr 12, 2006, 8:47 PM)
|