LESSON 10 OF 13
GET AND REAL-TIME CONTROL
Reading keys without waiting for RETURN.
INPUT stops everything until you press RETURN. GET K$ is different: it grabs a key if one is waiting, or gives an empty string if not, and never pauses. That is what games need.
The line GET K$:IF K$="" THEN 40 waits for any key. For a game you usually don't wait at all — you check the key, update the world, and loop.
This program moves a ball with W, A, S and D by erasing it, changing X or Y, and drawing it again at the new position. That erase-move-draw cycle is the heart of every action game.
Type with the keyboard under the screen, or tap the blue screen to use your phone's own keyboard. While a program runs, keys go to INPUT and GET. When it says READY., type a line and press RETURN to run it straight away.