Results 1 to 3 of 3

Thread: [RESOLVED] Detect If Colliding With Certain Part of A Picturebox?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2014
    Posts
    14

    Resolved [RESOLVED] Detect If Colliding With Certain Part of A Picturebox?

    Hello vbforums!

    I Have A Collision Detection Problem/Question....
    Is It Possible To Detect If I am Colliding With The Top Part of A Picturebox?
    So If I hit the Bottom It does Nothing If I hit the Top It Shows Let's Say A Messagebox?

    Heres and Example of What Im trying to Achieve:

    Name:  Exmaple.jpg
Views: 520
Size:  14.4 KB





    Thanks to Anyone Who Can Help

    PS: im using VS2013 .Net 4.5.1 or 4.5
    Last edited by redstonguy3442; Sep 6th, 2014 at 03:51 PM.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Detect If Colliding With Certain Part of A Picturebox?

    try this:

    Code:
    'ball is a moving picturebox
    'PictureBox1 is the pb where i test for collision with the top half
    If ball.Bounds.IntersectsWith(New Rectangle(PictureBox1.Location, New Size(PictureBox1.Width, PictureBox1.Height \ 2))) Then
        MsgBox("hit")
    End If

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2014
    Posts
    14

    Re: Detect If Colliding With Certain Part of A Picturebox?

    Thank You Exactly What I was looking for!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width