|
-
Mar 9th, 2013, 09:44 PM
#1
Thread Starter
Junior Member
[RESOLVED] Moving A PictureBox To A Certain Location - Help

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?
-
Mar 10th, 2013, 06:55 PM
#2
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!
-
Mar 10th, 2013, 08:21 PM
#3
Thread Starter
Junior Member
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:

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?
-
Mar 11th, 2013, 06:31 PM
#4
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|