The objective is to hit a key when the cursor lines up with the X.
SET TEXT FONT "SYSTEM",1:PRINT "The waiting game...":SUSPEND FOR KEY:waitgame(2, 0.1, 10):PRINT "You win!":SUSPEND FOR KEY:END
FUNCTION waitgame(boxes, boxtime#, levels)
boxes = boxes - 1:spacer$ = " ":cur$ = "|":box$ = "X"
gamestart:
curlevel = 0
nextlevel:
curlevel = curlevel + 1:IF curlevel > levels:EXITFUNCTION:ENDIF:curpos = -2:boxpos = RND(boxes)
REPEAT
CLS:LOCK BACKBUFFER:CLEAR ENTRY BUFFER:curpos = curpos + 1
IF curpos = -1:curspace$ = "":ELSE:curspace$ = spacer$:ENDIF
FOR x = 1 TO curpos:curspace$ = curspace$ + spacer$:NEXT x
boxspace$ = ">"
FOR x = 1 TO boxpos:boxspace$ = boxspace$ + spacer$:NEXT x
UNLOCK BACKBUFFER:IF curpos > boxpos THEN GOTO gameover
PRINT curlevel; "/"; levels:PRINT curspace$; cur$:PRINT boxspace$; box$:SLEEP boxtime#*1000
UNTIL LEN(ENTRY$()) AND curpos > -1
IF curpos = boxpos:GOTO nextlevel:ELSE:GOTO gameover:ENDIF
gameover:
PRINT "GAME OVER":SUSPEND FOR KEY:GOTO gamestart
ENDFUNCTION