作者skykegy (天边的云)
看板Visual_Basic
标题[VB6 ] 打地鼠游戏,我的图案显示不出来
时间Wed Jun 29 20:56:15 2005
想尝试做小游戏,但发现它很难...>< 请教各位大大喔!
这是我的程式码 是类似打地鼠那样的
'纪录老鼠状态的阵列
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
1F:推 clifflu:先确定 Timer1.Enabled 属性吧 220.129.68.25 06/29
2F:推 skykegy:是true耶,要改成false吗? 60.244.51.26 06/29
3F:推 skykegy:有好心人愿意解释什麽是rlist吗? 我不懂ijx三个 60.244.51.26 06/29
4F:推 BearWu:那个只是交换程式,类式扑克牌洗牌,以rlist做中 59.121.131.152 06/29
5F:→ BearWu:间转换的媒介! 59.121.131.152 06/29
6F:推 fumizuki:Timer1.Interval 单位毫秒 210.58.156.43 06/30
7F:推 fumizuki:=1/1000秒 210.58.156.43 06/30
8F:推 skykegy:我成功了耶 好感动喔~谢谢大家 ^0^ 60.244.51.24 06/30