Source code for this sketch |
Using the KeyboardSimilar to the mouse, your sketch can interact with the keyboard via functions and built-in variables. You can customize the code for the following functions:
The following built-in variables give you access to what is typed on the keyboard:
There are a lot of special tricks involved with using the keyboard because the keyboard is also used by other apps that may be running on your computer. You will probably have to experiment with small example sketches to find out how to make the keyboard do what you want, and you should consult the reference manual. Here are some things to watch out for:
|
Your assignment is to create a sketch in your portfolio that makes use of the keyboard. You might like to try a simple two player game where one player moves one object using AWSD and another player moves a second object using JIKL.