Results 1 to 4 of 4

Thread: [RESOLVED] Moving A PictureBox To A Certain Location - Help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2013
    Location
    Philippines
    Posts
    24

    Resolved [RESOLVED] Moving A PictureBox To A Certain Location - Help

    Name:  Penalty Shootout.jpg
Views: 517
Size:  126.0 KB

    The PictureBox I'm talking about is the Ball,

    And There Is A Horizontal PowerPack Line Moving Down From The Top of the Goal,
    and A Vertical PowerPack Line Moving To The Right From The Left of the Goal,

    and I'd like to move the Ball to the Location/Point of Intersection of those two lines,
    how will I move the ball?

    Because I tried using,

    picBall.Left -= Int(PowerBar.Value / 2)
    picBall.Top -= Int(PowerBar.Value / 2)

    If picBall.Left <= LineShape1.Y2 / 2 And picBall.Right <= LineShape2.X2 / 2 Then
    Shoot.Enabled = False
    Me.Refresh()
    End If

    I still don't have the codes on how to get the Intersection, and the "Shoot.Enabled = False" is to stop the ball from moving, the problem is if I use picBall.Left and picBall.Top, it's always moving to the left side, any other ideas?

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Moving A PictureBox To A Certain Location - Help

    A horizontal line runs from hx1,hy1 to hx2,hy1 and a vertical line runs from vx1,vy1 to vx1, vy2 so the intersection point is vx1, hy1.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2013
    Location
    Philippines
    Posts
    24

    Re: Moving A PictureBox To A Certain Location - Help

    So I had to assign variables in each point, Is your formula for the intersection point, also gets the intersection even the intersection is not in the center?

    For example this one:
    Name:  cats.jpg
Views: 253
Size:  128.5 KB

    what is the exact code on how to get this, because I don't really understand the codes I've found on the Internet.

    do I still have to use, picBall.Left and picBall.Top to move the picture box?

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2013
    Location
    Philippines
    Posts
    24

    Re: Moving A PictureBox To A Certain Location - Help

    I also want to use the PowerBar on the Bottom-Right Corner to be the basis of the picturebox's movement speed to the location, also called as "Shot Power", so If I'm gonna use New Point, my PowerBar will be useless, I need another code for that, please help, thank you for the post.

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