I might be in over my head since I've been taking VB.net for about 5 weeks now. However, I have been taking programming classes (c/c++) over the past year.

My basic goal is to make a program like this one
http://www.youtube.com/watch?v=EurGROIqZhg

The game is simple, click the ball and move the mouse forward and release. I've scoured the internet and my books and haven't found any tutorials on how to make the mouse do that.

I've kind of got an idea of how to program the calibration slider.

Any links or suggestions would be greatly appreciated.

Thanks.

Try this:

Public Class Form1

    Dim OldPos As Point

    Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
        OldPos = e.Location
    End Sub

    Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
        If e.Button = Windows.Forms.MouseButtons.Left Then
            PictureBox1.Location = PictureBox1.Location - (OldPos - e.Location)
        End If

    End Sub
End Class

The OldPos is the point inside of your ball (I'm using a picturebox). When you press the left button it grabs the ball. Then when you move the ball the picturebox checks if the left mouse button is pressed. If it is then the ball is being moved so it subtraces the current location from the old location. This gives you the delta of the move. Subtract this from the current ball location. Now you have moved the ball.

For lack of something to do........
Here is a bowing ball

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.Show()
        PictureBox1.Size = New Size(50, 50)
        PictureBox1.Location = New Point((Me.Width - PictureBox1.Width) / 2, (Me.Height - PictureBox1.Height) / 2)
        Dim gp As New GraphicsPath
        Dim hole As New Rectangle(25, 10, 5, 5)
        Dim bmp As New Bitmap(PictureBox1.Width, PictureBox1.Height)
        Dim g As Graphics = Graphics.FromImage(bmp)

        'Create region
        gp.AddEllipse(0, 0, PictureBox1.Width, PictureBox1.Height)
        Dim reg As New Region(gp)
        PictureBox1.Region = reg
        PictureBox1.BackColor = Color.Black

        ' Draw Ball
        g.FillEllipse(Brushes.White, hole)
        hole.X = 33 : hole.Y = 18
        g.FillEllipse(Brushes.White, hole)
        hole.X = 25 : hole.Y = 20
        g.FillEllipse(Brushes.White, hole)
        PictureBox1.Image = bmp.Clone
        g.Dispose()
        bmp.Dispose()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.