vb6做了个贪食蛇,有bug可悲的是知道有bug不知道什么情况下出现
我这个代码写得很凌乱,求大神帮我分析下什么时候会出现bug
bug Visual?Basic?6.0 贪食蛇
[解决办法]
'从随机数开始,向后(有折返)找一个背景点,确保一次命中。
Public Sub dimfoodran()
Dim i As Long
Dim j As Long
i = Int((1023) * Rnd + 1)
For j = i To 1023
If box(j).FillColor = vbBackground Then box(j).FillColor = vbBonusColour: Exit Sub
Next
For j = 0 To i - 1
If box(j).FillColor = vbBackground Then box(j).FillColor = vbBonusColour: Exit Sub
Next
End Sub