; A bouncing ball: the game loop Graphics 640, 480 SetBuffer BackBuffer() ; draw out of sight, then show it all at once x# = 320 : y# = 240 ; where the ball is dx# = 4 : dy# = 3 ; how far it moves each frame While Not KeyHit(1) ; until Escape is pressed ; move x = x + dx y = y + dy ; bounce off the edges If x < 20 Or x > 620 Then dx = -dx If y < 20 Or y > 460 Then dy = -dy ; draw Cls Color 255, 200, 0 Oval x - 20, y - 20, 40, 40 Color 255, 255, 255 Text 10, 10, "Press Escape to quit" Flip ; show the finished frame Wend End