VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Makes a ball have collision

by Gyro (Beginners) (1 Submission)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 13th March 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Makes a ball have collision

API Declarations


'Put the Circle in the Square
'Name the Square "Bounds"
'Name the Circle "Ball"
'Now add a timer
Dim MovRL, MovUD

Rate Makes a ball have collision



'Put the Circle in the Square
'Name the Square "Bounds"
'Name the Circle "Ball"
'Now add a timer

Private Sub Form_Load()
MovUD = 100
MovRL = 100
End Sub

Private Sub Timer1_Timer()
If Ball.Left <= Bounds.Left Then
MovRL = 100
ElseIf Ball.Top <= Bounds.Top Then
MovUD = 100
ElseIf Ball.Left + Ball.Width >= Bounds.Left + Bounds.Width Then
MovRL = -100
ElseIf Ball.Top + Ball.Height >= Bounds.Top + Bounds.Height Then
MovUD = -100
End If
Ball.Left = Ball.Left + MovRL
Ball.Top = Ball.Top + MovUD
End Sub


Download this snippet    Add to My Saved Code

Makes a ball have collision Comments

No comments have been posted about Makes a ball have collision. Why not be the first to post a comment about Makes a ball have collision.

Post your comment

Subject:
Message:
0/1000 characters