Dude1
Aug 12th, 2002, 03:48 PM
Sub DoBall()
Speed = 5
xFlag = 1
yFlag = 1
If xFlag = 1 Then
Ball.X = Ball.X + Speed
Else
Ball.X = Ball.X - Speed
End If
If yFlag = 1 Then
Ball.Y = Ball.Y + Speed
Else
Ball.Y = Ball.Y - Speed
End If
If Ball.X >= Form1.width Then
xFlag = 0
End If
If Ball.X <= 100 Then
xFlag = 1
End If
If Ball.Y >= Form1.height Then
yFlag = 0
End If
If Ball.Y <= 100 Then
yFlag = 1
End If
End Sub
The above code works when Form property is set to 1-Twip, but when I change it to 3-Pixel the code no longer works. The ball flies of the form. Why? Please help!
Thanks
Speed = 5
xFlag = 1
yFlag = 1
If xFlag = 1 Then
Ball.X = Ball.X + Speed
Else
Ball.X = Ball.X - Speed
End If
If yFlag = 1 Then
Ball.Y = Ball.Y + Speed
Else
Ball.Y = Ball.Y - Speed
End If
If Ball.X >= Form1.width Then
xFlag = 0
End If
If Ball.X <= 100 Then
xFlag = 1
End If
If Ball.Y >= Form1.height Then
yFlag = 0
End If
If Ball.Y <= 100 Then
yFlag = 1
End If
End Sub
The above code works when Form property is set to 1-Twip, but when I change it to 3-Pixel the code no longer works. The ball flies of the form. Why? Please help!
Thanks