by The Kuiker (1 Submission)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 16th March 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
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
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
No comments have been posted about Extremely Simple code to have objects bounce around the screen. Modifies to Application size change. Why not be the first to post a comment about Extremely Simple code to have objects bounce around the screen. Modifies to Application size change.