Question simple editor for a basketball playbook

herms14

New member
Joined
Nov 8, 2009
Messages
4
Programming Experience
Beginner
guys...I just would like to ask for some assistance. Im trying to develop a playbook application for basketball. My aim is to make a simple editor that would allow users to design plays and then be able to animate it to show how the plays work. My problem is when I draw a line how do I make a picture box move given the line I just drew. The object (lets say a circle) must follow the line I drew during animation. Hope to hear from you guys soon.Thanks a alot:)
 
yuhooooo...anybody home????
Hi herms, you probably noticed this is a forum that goes for quality rather than speed. At least, it doesn't go for speed;).

Here is an outline of how I would go about making a playbook:

1. Define a list of points to hold the play track:
VB.NET:
Dim AnimTrack As New List (Of Point)

2. To record a play track, use a timer with an appropriate interval (say 25 ms). You could start and stop the timer with the MouseDown and MouseUp events. I'll assume you are using Form1 to draw the play.
VB.NET:
Private Sub Timer1_Tick (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
   Dim p As Point = Me.PointToClient(Windows.Forms.MousePosition)
   PlayTrack.Add(p)
End Sub

3. Draw the track in Form1's Paint Event, for example:
VB.NET:
If PlayTrack.Count > 1 Then
   e.Graphics.DrawCurve(Pens.Red, PlayTrack.ToArray)
End If


4. To animate the play using a PictureBox (PictureBox1, with background = Color.Transparent), start a Timer to run the PictureBox along the track. For example:
VB.NET:
    Dim index As Integer = 0
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Dim p As Point = PlayTrack(index)
        p.Offset(-PictureBox1.Width \ 2, -PictureBox1.Height \ 2)
        PictureBox1.Location = p
        Me.Refresh()
        index += 1
        If index >= PlayTrack.Count Then Timer2.Enabled = False
    End Sub

Obviously, there's a lot of details still to be worked out but I hope these hints will get you started.

cheers, Vic
 
Hi Vic,

I followed what you said but nothing happened in my program. What I would like to do is when I click a button I would be able to draw a line in the picturebox with a basketball court backgound. the the image would follow that line during animation. ive uploade a zip file of my program..it doesn't have any code yet just the interface.Could I ask some more help on how to do this? thanks:)
 

Attachments

  • projectrial.zip
    81.6 KB · Views: 30
Last edited by a moderator:
Interfaces don't do much without code. Why don't you have try at writing some? I've given you most of it. If you are not sure how to add a timer to your form and put code in its Tick event, you should try a beginner's course in VB.Net. Cheers, VicJ/BB
 
Last edited:
Back
Top