[VB6 ] 打地鼠遊戲,我的圖案顯示不出來
想嘗試做小遊戲,但發現它很難...>< 請教各位大大喔!
這是我的程式碼 是類似打地鼠那樣的
'紀錄老鼠狀態的陣列
Dim m_status(3) As Integer
_______________________________________________________________
Private Sub Form_Load()
Dim i As Integer
Randomize
'將老鼠狀態設定為0
For i = 0 To 3
m_status(i) = 0
Image1(i).Visible = False
Next i
End Sub
_______________________________________________________________
'在老鼠物件上按一下左鍵的副程式
Private Sub Image1_Click(Index As Integer)
Dim x As Integer
Image1(Index).Visible = False
m_status(Index) = 0
x = Val(Label2.Caption)
x = x + 10
Label2.Caption = Str(x)
End Sub
_______________________________________________________________
'控制老鼠顯示的時間事件程式
Private Sub Timer1_Timer()
Dim i, j, x As Integer
rlist = Array(0, 1, 2, 3)
For i = 0 To 3
j = Int(Rnd() * 4)
x = rlist(i)
rlist(i) = rlist(j)
rlist(j) = x
Next i
For i = 0 To 3
If m_status(rlist(i)) = 0 Then
m_status(rlist(i)) = 1
Image(rlist(i)).Visible = True
Exit For
End If
Next i
End Sub
我啟動後,程式根本沒跑耶!老鼠出不來...
是我在Timer的設定有錯嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.244.51.26
推
220.129.68.25 06/29, , 1F
220.129.68.25 06/29, 1F
推
60.244.51.26 06/29, , 2F
60.244.51.26 06/29, 2F
推
60.244.51.26 06/29, , 3F
60.244.51.26 06/29, 3F
推
59.121.131.152 06/29, , 4F
59.121.131.152 06/29, 4F
→
59.121.131.152 06/29, , 5F
59.121.131.152 06/29, 5F
推
210.58.156.43 06/30, , 6F
210.58.156.43 06/30, 6F
推
210.58.156.43 06/30, , 7F
210.58.156.43 06/30, 7F
推
60.244.51.24 06/30, , 8F
60.244.51.24 06/30, 8F
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章