ArcBasicDocs

tutorials/beginner

06_bounce.abs

28 lines of ArcBasic. Words in colour that are commands link to their help page. To run it, download ArcBasic, open the file and press F5.

Download 06_bounce.absAll files in this folder

06_bounce.abs
; A bouncing ball: the game loopGraphics 640, 480SetBuffer BackBuffer()        ; draw out of sight, then show it all at oncex# = 320 : y# = 240           ; where the ball isdx# = 4 : dy# = 3             ; how far it moves each frameWhile 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 frameWendEnd