; WaitKey Example ; --------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; Load the player ship sprite for the launch scene ship=LoadImage("media/player.bmp") ; Draw the title frame FIRST, then halt - the player needs to see ; the prompt while the program is blocked inside WaitKey. Cls Text 320,180,"* S T A R P A T R O L *",True Text 320,220,"Press any key to launch",True Flip ; WaitKey halts the program until a key is pressed, then returns ; the key's ASCII code. key=WaitKey() y=480 While Not KeyDown(1) Cls ; The launched ship climbs and wraps forever y=y-3 If y<-36 Then y=480 DrawImage ship,304,y Text 0,0,"Esc: exit" Text 0,20,"WaitKey() returned ASCII code "+key If key>=32 And key<=126 Then Text 0,40,"That is the character '"+Chr$(key)+"'" Flip Wend End