This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. |
This tutorial shows how to detect if a numpad key is down in Scratch 1.4.
Script
The When () Key Pressed block fires either when a number key is pressed using the writing row or the numeric pad. The Key () Pressed? block with the numbers 0-9 selected, however, only reports true if the number in the writing row is down.
Add this script to the project:
when [1 v] key pressed if <key [1 v] pressed?> then set [type of number v] to [writing field "1"] else set [type of number v] to [numeric field "1"] end
The script is now complete. Repeat for the other 9 keys.
Example Uses
- Adding a hidden menu
- Making Operating System projects more realistic