2008年12月17日 星期三

雙跳跳球VB6版




Dim dx, dy
Dim dx1, dy1
Private Sub Form_Load()
dx = 1
dy = 1
dx1 = 1
dy1 = 1

Timer1.Interval = 20
r.FillColor = vbYellow
End Sub

Private Sub Timer1_Timer()
If r.Left > 6480 Then dx = -1
If r.Left < 1 Then dx = 1
r.Left = r.Left + 150 * dx

If r.Top > 3960 Then
dy = -1
r.FillColor = vbRed
End If
If r.Top < 1 Then
dy = 1
n = Int(Rnd * 16)
r.FillColor = QBColor(n)
End If
r.Top = r.Top + 150 * dy

'
'
If t.Left > 6480 Then dx1 = -1
If t.Left < 1 Then dx1 = 1
t.Left = t.Left + 150 * dx1

If t.Top > 3960 Then
dy1 = -1
t.FillColor = vbRed
End If
If t.Top < 1 Then
dy1 = 1
n = Int(Rnd * 16)
t.FillColor = QBColor(n)
End If
t.Top = t.Top + 150 * dy1
End Sub

沒有留言: