Tutorial — Blitz Basic

Cls clears. Flip displays. If you forget Flip , you see nothing. If you forget Cls , you get a messy "light trail" effect. 3. Your First Moving Pixel (A Ball) Let’s make a red ball bounce across the screen. We need variables for position ( x ) and speed ( dx ).

Have you dusted off your copy of BlitzBasic lately? Let me know what you're building in the comments below!

By: Retro Dev Journal Read Time: 10 minutes blitz basic tutorial

Cls ; Clear the screen (paint it black)

Type Player Field x, y Field health Field color_r, color_g, color_b End Type ; Create a new player me.Player = New Player me\x = 400 me\y = 300 me\health = 100 me\color_r = 0 me\color_g = 255 me\color_b = 0 Cls clears

; --- Ball --- ball_x = 400 ball_y = 300 ball_dx = 4 ball_dy = 3

; Show FPS or instructions Color 255, 255, 255 ; White text Text 10, 10, "X Position: " + x If you forget Cls , you get a messy "light trail" effect

; 3. Collisions (Top/Bottom walls) If ball_y < 5 Or ball_y > 595 Then ball_dy = -ball_dy

Back
Top Bottom