a = stack(i).x + 1
'右边
Do While a < 6
If arr(a, b) = 0 Then
a = a + 1
Else
arr(a, b) = arr(a, b) + 1
Exit Do
End If
Loop
a = stack(i).x
b = stack(i).y - 1
'上边
Do While b >= 0
If arr(a, b) = 0 Then
b = b - 1
Else
arr(a, b) = arr(a, b) + 1
Exit Do
End If
Loop
a = stack(i).x
b = stack(i).y + 1
'下边
Do While b < 6
If arr(a, b) = 0 Then
b = b + 1
Else
arr(a, b) = arr(a, b) + 1
Exit Do
End If
Loop
Next i
'检查下一秒还有没有需要爆的?,没有就停止计时器
For i = 0 To 5
For j = 0 To 5
If arr(i, j) > 4 Then
isdone = False
End If
Next j
Next i
If isdone = True Then Timer1.Enabled = False
'检查是否完成本局了?
isdone = True
For i = 0 To 5
For j = 0 To 5
If arr(i, j) > 0 Then
isdone = False
End If
Next j
Next i
If isdone = True Then
MsgBox "本局完成,加一水滴,开始下一局"
drops = drops + 1
newgame
End If
calcDC
Me.Refresh
End Sub
Sub newgame()
FillRect mDC, R, GetSysColorBrush(COLOR_WINDOW)
Randomize
Dim str As String
Dim i As Long, j As Long
For i = 0 To 5
For j = 0 To 5
arr(i, j) = Rnd * 4
str = arr(i, j)
If str <> "0" Then
Call TextOut(mDC, 67 * i + 20, 67 * j, str, LenB(str) - 1)
End If
Next j
Next i
calcDC
Me.Refresh