|
-
Jun 8th, 2002, 11:11 AM
#1
Thread Starter
New Member
whats wrong with this code?
i have this code -
Option Explicit
Dim jump As Integer
Dim xPos As Integer
Private Sub MoveButton()
xPos = Int((3400) * Rnd) \ 480
img1.Left = 120 + xPos * 480
End Sub
Private Sub cmd1_Click()
Timer1.Interval = 400
Randomize
lblEnd.Caption = ""
End Sub
Private Sub Timer1_Timer()
Call MoveButton
jump = jump + 1
If jump = 20 Then Call endgame
End Sub
Private Sub endgame()
Timer1.Interval = 0
lblEnd = Label1(xPos).Caption
End Sub
It works the first time you click the cmd1 button, but after that, it doesnt stop anymore...anyone know what is wrong with it?
(i have 8 labels positioned with numbers 1 to 8 on them and wherever img1 lands on, that is the number that appears on another label)
-
Jun 8th, 2002, 11:17 AM
#2
Frenzied Member
try putting your code in [ vbcode ]...[ /vbcode ] tags, it makes it easier to read. Also give more information, what is it supposed to do??
-
Jun 8th, 2002, 11:18 AM
#3
The picture isn't missing
in endgame you have to reset jump to 0 or else it will keep counting 20, 21,22....
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jun 8th, 2002, 11:45 AM
#4
Thread Starter
New Member
how do i reset the timer to 0?
isnt that what "timer1.interval = 0" command does?
there are an array of 8 labels in a row and each label has a number from 1 to 8 on them. the arrow moves left to right above these labels...
this program makes an image(of an arrow) randomly jump from left to right 20 times and stops on the 20th jump. wherever that image stops determines the number that will be printed on another label on the form.
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
|