Problems solved: 1) Some (like @grandpasp), don't like unnecessary "forever" loops. This is event driven key detection and broadcast message generation. (watch the green flag) 2) Scratch does not detect the standard "shift" key. This code allows any key (configurable on-the-fly) to be used as a shift key. 3) Sometimes, more than one key is used to execute the same function (eg w and up-arrow). This code will generate only one broadcast message for either of two keys. 4) Sometimes it's desirable to control whether "key-repeat" (holding down a key to get multiple key strokes), is accepted. This code allows key-repeat control on-the-fly.
Keys configured in this demo: x y z shift-x shift-y shift-z w / up-arrow a / left arrow s / down-arrow d / right-arrow shift - w / up-arrow shift - a / left arrow shift - s / down-arrow shift - d / right-arrow See inside. Thumbnail generated by Edge Copilot.