Can't beleive your lecturer has not obfuscated the example program!!LOL
Reflector is a handy program for decompiling .NET exe's:
http://www.aisto.com/roeder/dotnet/
Its actually a very easy what they want you to do - all the difficult bits have been done in the classes! Took me a minute to get the car going scrolling in both directions across the screen!
I give you some pointers:
1. Drag a timer control onto form1 and then double click it in order for the event stub to appear
2. Delete existing code and Paste this into form1
Public Class Form1
Private draw As New Spike
Private newcar As New Car(20, 20, 100, 50, Color.Orange, 40)
Private drawarea As Graphics
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
drawarea = picArea.CreateGraphics
draw = New Spike(picArea.Width / 1 - 10, picArea.Height / 1 - 10, 20, Color.Red, Color.Black)
End Sub
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
btnStart.Enabled = False
newcar.drawcar(drawarea)
draw.Draw(drawarea)
Timer1.Enabled = True
Timer1.Interval = 100 'change this for different speed
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If newcar.X = picArea.Size.Width Then 'not perfect but will do.....
newcar.Directions = Car.direction.Left
End If
If newcar.X <= 0 Then 'not perfect but will do.....
newcar.Directions = Car.direction.Right
End If
newcar.MoveCar(drawarea)
'you now need some code here to see if spike (draw) and Car (newcar) have hasCollided
'do this by looking at the x, y and width of spike and car.
End Sub
End Class
3. A clue to finish off the keyboard stuff....
keypress event on form1
Dan