hyperfire
New Member
I have to make a game for a lesson in school and unfortunately i have to make it on the visual basic program in school rather than my home version which is more modern and unfortunately not compatible. ( i can't install anything, i'm just going to run it in debug.)
The game is a simple game where you click on a christmas present that moves every .65 of a second the code so far is as follows.
Dim time As Integer
Dim score As Integer
Dim highscore As Integer
Dim bestgroup As Integer
Dim group As Integer
Private Sub Command1_Click()
group = InputBox("Please enter your group number", "Group number", "0")
score = 0
time = 0
Timer1.Enabled = True
Timer2.Enabled = True
Image1.Visible = True
End Sub
Private Sub Command3_Click()
Timer1.Enabled = False
Timer2.Enabled = False
Image1.Visible = False
If score > highscore Then bestgroup = group
If score > highscore Then highscore = score
End Sub
Private Sub Command5_Click()
MsgBox ("The highscore of " & highscore & " was scored by group number " & bestgroup & ".")
End Sub
Private Sub Picture1_Click()
score = score + 10
Text1.Text = score
End Sub
Private Sub Timer1_Timer()
time = time + 1
If score > highscore Then bestgroup = group
If score > highscore Then highscore = score
If time = 60 Then Timer1.Enabled = False
If time = 60 Then Timer2.Enabled = False
If time = 60 Then Picturebox1.Visible = False
End
My problem is the function that makes the present move to random locations, I'm not familiar with the old version of vb and it is different. There is no one in school who i know of (including teachers.) who could help. Can anyone suggest some code that upon a timer "ticking" moves an image to a random location.
The game is a simple game where you click on a christmas present that moves every .65 of a second the code so far is as follows.
Dim time As Integer
Dim score As Integer
Dim highscore As Integer
Dim bestgroup As Integer
Dim group As Integer
Private Sub Command1_Click()
group = InputBox("Please enter your group number", "Group number", "0")
score = 0
time = 0
Timer1.Enabled = True
Timer2.Enabled = True
Image1.Visible = True
End Sub
Private Sub Command3_Click()
Timer1.Enabled = False
Timer2.Enabled = False
Image1.Visible = False
If score > highscore Then bestgroup = group
If score > highscore Then highscore = score
End Sub
Private Sub Command5_Click()
MsgBox ("The highscore of " & highscore & " was scored by group number " & bestgroup & ".")
End Sub
Private Sub Picture1_Click()
score = score + 10
Text1.Text = score
End Sub
Private Sub Timer1_Timer()
time = time + 1
If score > highscore Then bestgroup = group
If score > highscore Then highscore = score
If time = 60 Then Timer1.Enabled = False
If time = 60 Then Timer2.Enabled = False
If time = 60 Then Picturebox1.Visible = False
End
My problem is the function that makes the present move to random locations, I'm not familiar with the old version of vb and it is different. There is no one in school who i know of (including teachers.) who could help. Can anyone suggest some code that upon a timer "ticking" moves an image to a random location.