From Test-Scratch-Wiki

Archive.png This article or section documents a feature not included in the current version of Scratch (2.0). It is only useful from a historical perspective.

This tutorial shows you how to detect if a numpad key is down in Scratch 1.4.


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:

when [1 v] key pressed
if <key [1 v] pressed?>
set [type of number v] to [writing field "1"]
set [type of number v] to [numeric field "1"]

You now have a script that will detect if the "1" numeric key is pressed.

play note (40 v) for (0.5) beats play note (40 v) for (0.5) beats

Example Uses

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.