Tutorial - Blitz Basic
; Keep ball on screen (Boundaries) If x < 0 Then x = 0 If x > 768 Then x = 768 If y < 0 Then y = 0 If y > 568 Then y = 568
Graphics 800, 600, 32, 2 SetBuffer BackBuffer() ; --- Player 1 (Left) --- p1_y = 250 p1_score = 0 blitz basic tutorial
If ball_x > 770 And ball_x < 780 And ball_y > p2_y - 20 And ball_y < p2_y + 60 Then ball_dx = -ball_dx EndIf ; Keep ball on screen (Boundaries) If x
Flip Delay 10 Wend
; 3. Collisions (Top/Bottom walls) If ball_y < 5 Or ball_y > 595 Then ball_dy = -ball_dy 2 SetBuffer BackBuffer()
Flip
If ball_x > 800 Then p1_score = p1_score + 1 ball_x = 400 ball_y = 300 ball_dx = -ball_dx Delay 1000 EndIf