Number Pad Detection

Материал из Поле цифровой дидактики

Шаблон:Obsolete feature 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

See Also

ja:テンキーを検出する