VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



It's a very basic game. This Pong game is one of the best and easy game to play. It's kinda like a

by L-C (1 Submission)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 24th January 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

It's a very basic game. This Pong game is one of the best and easy game to play. It's kinda like a disco pong cause the ball switches color

Rate It's a very basic game. This Pong game is one of the best and easy game to play. It's kinda like a



Dim hasard As Integer
Dim direction As Integer


Private Sub Form_Load()

point1.Caption = 0
point2.Caption = 0

Randomize (Timer)
hasard = Int(4 * Rnd(1)) + 1
direction = hasard

End Sub

Private Sub play_Click()
Timer1.Enabled = Not Timer1.Enabled

End Sub

Private Sub Timer1_Timer()


Select Case direction

Case 1
    ball.Left = ball.Left + 100
    ball.Top = ball.Top - 100
    If ball.Left + ball.Width >= field.Left + field.Width Then direction = 4
    If ball.Top <= field.Top Then direction = 2
    If ball.Top + ball.Height / 2 >= blade2.Top And ball.Left + ball.Width > blade2.Left And ball.Top + ball.Height <= blade2.Top + blade2.Height Then direction = 4
    If ball.Left + ball.Width >= field.Left + field.Width Then point1.Caption = point1.Caption + 1

Case 2
    ball.Left = ball.Left + 100
    ball.Top = ball.Top + 100
    If ball.Left + ball.Width >= field.Left + field.Width Then direction = 3
    If ball.Top + ball.Height >= field.Height Then direction = 1
    If ball.Top + ball.Height / 2 >= blade2.Top And balle.Left + balle.Width > palette2.Left And balle.Top + balle.Height <= blade2.Top + blade2.Height Then direction = 3
    If ball.Left + ball.Width >= blade.Left + blade.Width Then point1.Caption = point1.Caption + 1
    
Case 3
    ball.Left = ball.Left - 100
    ball.Top = ball.Top + 100
    If ball.Left <= field.Left Then direction = 2
    If ball.Top + ball.Height >= field.Height Then direction = 4
    If ball.Top + ball.Height / 2 >= blade1.Top And balle.Left < blade1.Left + blade1.Width And balle.Top + ball.Height <= blade1.Top + blade1.Height Then direction = 2
    If ball.Left <= field.Left Then point2.Caption = point2.Caption + 1
    
Case 4
    ball.Left = ball.Left - 100
    ball.Top = ball.Top - 100
    If ball.Top <= field.Top Then direction = 3
    If ball.Left <= field.Left Then direction = 1
    If ball.Top + ball.Height / 2 >= blade1.Top And ball.Left < blade1.Left + blade1.Width And ball.Top + ball.Height <= blade1.Top + blade1.Height Then direction = 1
    If ball.Left <= field.Left Then point2.Caption = point2.Caption + 1
    
End Select

Randomize (Timer)
hasard = Int(5 * Rnd(1)) + 1
couleur = hasard

Select Case color

Case 1
    ball.FillColor = &HFFFF&
    
Case 2
    ball.FillColor = &HFF&
    
Case 3
    ball.FillColor = &HFF0000
    
Case 4
    ball.FillColor = &HC000C0
    
Case 5
    ball.FillColor = &HFFFF00
    
End Select


End Sub


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 38 Then blade2.Top = blade2.Top - 150
If KeyCode = 40 Then blade2.Top = blade2.Top + 150
If KeyCode = 65 Then blade1.Top = blade1.Top - 150
If KeyCode = 90 Then blade1.Top = blade1.Top + 150

If KeyCode = 38 And blade2.Top <= field.Top Then blade2.Top = blade2.Top + 150
If KeyCode = 40 And blade2.Top + blade2.Height >= field.Height Then blade2.Top = blade2.Top - 150
If KeyCode = 65 And blade1.Top <= field.Top Then blade1.Top = blade1.Top + 150
If KeyCode = 90 And blade1.Top + blade1.Height >= field.Height Then blade1.Top = blade1.Top - 150

If KeyCode = 97 Then Timer1.Interval = 20
If KeyCode = 98 Then Timer1.Interval = 40
If KeyCode = 99 Then Timer1.Interval = 60
If KeyCode = 100 Then Timer1.Interval = 80
If KeyCode = 101 Then Timer1.Interval = 100

End Sub



Download this snippet    Add to My Saved Code

It's a very basic game. This Pong game is one of the best and easy game to play. It's kinda like a Comments

No comments have been posted about It's a very basic game. This Pong game is one of the best and easy game to play. It's kinda like a . Why not be the first to post a comment about It's a very basic game. This Pong game is one of the best and easy game to play. It's kinda like a .

Post your comment

Subject:
Message:
0/1000 characters