when [] key pressed works only once

  1. What browsers show this problem?
    Firefox
  2. Please share an example project (if possible).
    https://snap.berkeley.edu/snap/snap.html#present:Username=fridolinux&ProjectName=Hat%20block
  3. Describes the steps to reproduce this issue.
    Have two Hat block script pic blocks and press both keys
  4. What does Snap! currently do?
    Execute only one script
  5. What should Snap! do instead?
    execute both scripts

Do you mean you press two keys with two fingers at the same moment? I think probably Snap! doesn't get both of them, but maybe it could with a different API. I agree that it'd be cool.

This is a hardware issue, we're only getting the first key from the OS. Same in Scratch, btw.

State of any key can be tested but hat block is started only for last key press by OS autorepeat.
Hat block script pic (1)

IMHO It's by design. Method "SpriteMorph.allHatBlocksForKey" should be based on state of StageMorph.keysPressed[] not key press event. Or better yet "when key pressed" may be fired only once for simplicity. Complex interaction can be based on sensing.

Or have a real event queue, and queue up key-down and key-up events to let kids program their own n-key rollover.

<key ... pressed?> is multi-key rollover capable for plain keys. N-limited only by OS/hardware.

I experiance the same problem but it's only with the spacebar and it's more than 2 or 3 keys, but if I don't use the spacebar, it works fine

Project


can bu used to test multiple keys in your systems.

KeysRollover script pic

This is a fix for keys to be press at the same time

Untitled script pic

I know, but isn't it weird, that you can not use untitled script pic two times, but untitled script pic-1 works?

yeah

It's exactly how OS and browser works. Try multiple keys in browser bar or shell window.
Snap gives You added value by storing key state.