Libros recomendados por libreras y libreros

Blitz: Basic Tutorial

Run that. You just made a physics engine. Sort of. 4. Input Handling (Keyboard) Blitz makes reading the keyboard stupidly easy using KeyDown() (holding) or KeyHit() (single press).

At the top of your code (before the loop), load the sound:

; 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 blitz basic tutorial

; 2. Ball Movement ball_x = ball_x + ball_dx ball_y = ball_y + ball_dy

First, put a file called boop.wav in your project folder. Run that

Flip Delay 10 Wend

By: Retro Dev Journal Read Time: 10 minutes Ball Movement ball_x = ball_x + ball_dx ball_y

; Keep paddles on screen p1_y = Min(Max(p1_y, 10), 540) p2_y = Min(Max(p2_y, 10), 540)

Graphics 800, 600, 32, 2 SetBuffer BackBuffer() ; --- Player 1 (Left) --- p1_y = 250 p1_score = 0

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

Flip

0 Compartir
Twittear
Compartir