- Home
·
- Games
·
- Extremely Simple code to have objects bounce around the screen. Modifies to Application size change
Extremely Simple code to have objects bounce around the screen. Modifies to Application size change
Extremely Simple code to have objects bounce around the screen. Modifies to Application size changes
API Declarations
'CREATE:
'Create four timers; timUp, timBottom, timLeft, TimRight: All interval "1"
'Create a shape called shpBall
Rate Extremely Simple code to have objects bounce around the screen. Modifies to Application size change
(1(1 Vote))
timUp.Enabled = True
timLeft.Enabled = False
timBottom.Enabled = False
timRight.Enabled = True
End Sub
Private Sub timBottom_Timer()
shpball.Top = shpball.Top + Speed
If shpball.Top + shpball.Height >= Form1.ScaleHeight Then
timUp.Enabled = True
timBottom.Enabled = False
End If
End Sub
Private Sub timLeft_Timer()
shpball.Left = shpball.Left - Speed
If shpball.Left <= 0 Then
timLeft.Enabled = False
timRight.Enabled = True
End If
End Sub
Private Sub timRight_Timer()
shpball.Left = shpball.Left + Speed
If shpball.Left + shpball.Width >= Form1.ScaleWidth Then
timLeft.Enabled = True
timRight.Enabled = False
End If
End Sub
Private Sub timUp_Timer()
shpball.Top = shpball.Top - Speed
If shpball.Top <= 0 Then
timUp.Enabled = False
timBottom.Enabled = True
End If
End Sub
Extremely Simple code to have objects bounce around the screen. Modifies to Application size change Comments
No comments yet — be the first to post one!
Post a Comment