Discuss Scratch

Awesomeperson159
Scratcher
8 posts

Improving <when key pressed> - More Buttons, Customizable Controls

Have you ever played a Scratch project and thought, “These controls are a bit awkward. Why do I have to have my pinky on Z with WASD?” or “Why can't I use Ctrl to run?” or “Why did the creator have to use arrow keys to make the controls work?” Probably because Scratch doesn't support the detection of important buttons like Ctrl, Shift, and Tab.

Simply put, I feel that there's not enough buttons that can be detected by Scratch. I've seen a glitched boolean that registered Enter presses in a featured project, but it's glitched and unusable. So, I'm here today to make a suggestion to add more buttons to the
<key [ v] pressed?>
block.

The Blocks
<key [shift v] pressed?>
<key [ctrl v] pressed?>
<key [tab v] pressed?>
<key [backspace v] pressed?>
<key [enter/return v] pressed?>
<key [alt/command v] pressed?>

Why is this necessary?
Have you ever tried making a platformer? It's a bit of a challenge for new Scratchers, however for those with experience, it's easily done. Maybe, you want to add a run mechanic, and you use WASD for your platformer (which is widely considered the best way to do it). WASD is so good because you can reach so many buttons and still have your other hand on the mouse/arrows/keys on other side of the keyboard, whilst arrow keys are pretty isolated in the bottom-right.. These buttons are Q, E, F, R, C, Tab, Space, Ctrl, and Shift, most notably the latter three. Notice how two of the 3 most important aren't even options to detect with the
<key [ v] pressed?>
boolean. This makes it very hard to make a basic run mechanic in a WASD platformer without making you cup your left hand and hold your pinky on Z. Try it. Doesn't it feel… wrong? Now move your pinky to Ctrl (or the button in the bottom-right of your keyboard). It probably feels much better. But you can't use it. Why not?

Customizable Controls
Why can't I put a variable in the key pressed boolean? It would allow for changeable controls right inside the editor without a billion blocks that look like this in your project:
if<<key [left arrow] pressed?> and <(ctrlleft) = [left arrow]> or <key [a] pressed?> and <(ctrlleft) = [a]> or <etc.>> then
change x by (-5)
end
It would allow anyone to play any way they want.

EDIT: Variables in the bool is in the current version of Scratch 3.0! Try it!

Overall, the
<key [ v] pressed?>
could use some improvement to make Scratch a better language.

Last edited by Awesomeperson159 (May 14, 2018 16:04:03)

E_Equals_EmCeSquare2
Scratcher
33 posts

Improving <when key pressed> - More Buttons, Customizable Controls

Agree to everything you said. I personally prefer to be able to place reporters into the
<key [space v] pressed?>
dropdown without hacking the block itself, like
set [key v] to [shift]
if <key (key) pressed?> then
...
and also with more dropdown options. I've sometimes felt that there could be more controls enabled, especially since this block can detect pressed keys outside of the current dropdown menu when hacked.

change [support  v] by (1)
_nix
Scratcher
1000+ posts

Improving <when key pressed> - More Buttons, Customizable Controls

The “customizable controls” part of this suggestion is basically implemented into Scratch 3.0 – you can now put blocks inside the “key (…) pressed?” sensing block, ilke E_Equals_EmCeSquare2 posted:

ask [What layout? ("arrows" or "wasd")] and wait
if <(answer) = [arrows]> then
set [up key v] to [up arrow]
say [Using arrow keys]
else
set [up key v] to [w]
say [Using WASD]
end
forever
if <key (up key) pressed> then
jump
end
end

define jump
...

It can't detect keys like “control” or “shift”, but it's definitely better than not being able to stick stuff in the block at all.

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
Awesomeperson159
Scratcher
8 posts

Improving <when key pressed> - More Buttons, Customizable Controls

_nix wrote:

The “customizable controls” part of this suggestion is basically implemented into Scratch 3.0 – you can now put blocks inside the “key (…) pressed?” sensing block, ilke E_Equals_EmCeSquare2 posted:

ask [What layout? ("arrows" or "wasd")] and wait
if <(answer) = [arrows]> then
set [up key v] to [up arrow]
say [Using arrow keys]
else
set [up key v] to [w]
say [Using WASD]
end
forever
if <key (up key) pressed> then
jump
end
end

define jump
...

It can't detect keys like “control” or “shift”, but it's definitely better than not being able to stick stuff in the block at all.
Oh wow, didn't think they added it! That's fantastic!
CatIsFluffy
Scratcher
100+ posts

Improving <when key pressed> - More Buttons, Customizable Controls

A Scratch 3.0 userscript might be able to add support for modifier key detection.
_nix
Scratcher
1000+ posts

Improving <when key pressed> - More Buttons, Customizable Controls

CatIsFluffy wrote:

A Scratch 3.0 userscript might be able to add support for modifier key detection.
It could, but that wouldn't help for other people running your project, because without the userscript, the blocks wouldn't work. (You would have to ask users to run your userscript, and this wouldn't be any better than asking someone to run a browser extension or arbitrary JS in their console.)

OTOH, I'm hoping the Scratch Team will eventually add/official-ize a Scratch 3.0 extension that adds a “modifier (shift/control/etc) pressed?” block. That makes sense to me, since many extensions are already hardware-dependent. For example, projects that use the LEGO WeDo 2.0 extension can't really be run if the user doesn't have a WeDo, which many people don't – so it doesn't seem outrageous to think that an extension for handling keyboards (which many, but not all users have) would be allowed.

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
chexbox
Scratcher
100+ posts

Improving <when key pressed> - More Buttons, Customizable Controls

_nix wrote:

CatIsFluffy wrote:

A Scr **Snip** ion.
It could, but that wouldn't help for other people running your project, because without the userscript, the blocks wouldn't work. (You would have to ask users to run your userscript, and this wouldn't be any better than asking someone to run a browser extension or arbitrary JS in their console.)

OTOH, I'm hoping the Scratch Team will eventually add/official-ize a Scratch 3.0 extension that adds a “modifier (shift/control/etc) pressed?” block. That makes sense to me, since many extensions are already hardware-dependent. For example, projects that use the LEGO WeDo 2.0 extension can't really be run if the user doesn't have a WeDo, which many people don't – so it doesn't seem outrageous to think that an extension for handling keyboards (which many, but not all users have) would be allowed.
Support of this ^^^

GiggyMantis
Scratcher
65 posts

Improving <when key pressed> - More Buttons, Customizable Controls

Support.

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
gilbert_given_189
Scratcher
500+ posts

Improving <when key pressed> - More Buttons, Customizable Controls

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░████████░░░░██░░░░░░██░░██░░░░░░██░░████████░░░░
░░██░░░░░░██░░██░░░░░░██░░████░░████░░██░░░░░░██░░
░░██░░░░░░██░░██░░░░░░██░░██░░██░░██░░██░░░░░░██░░
░░████████░░░░██░░░░░░██░░██░░░░░░██░░████████░░░░
░░██░░░░░░██░░██░░░░░░██░░██░░░░░░██░░██░░░░░░░░░░
░░██░░░░░░██░░██░░░░░░██░░██░░░░░░██░░██░░░░░░░░░░
░░████████░░░░░░██████░░░░██░░░░░░██░░██░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

If you see a line above this text, it means that below this text is my signature.
This place is just a memory to me, I may return occasionally but I'm busy.
I guess I'm an ATer now.

I think I may have seasoned my posts a bit too much.


Colored Pencil is supposed to color the siggy, but Scratch says it's too big.


There is nothing here…



don don pan pan
dondo pan pan
-InsanityPlays-
Scratcher
1000+ posts

Improving <when key pressed> - More Buttons, Customizable Controls

Awesomeperson159 wrote:

<key [alt/command v] pressed?>
<key [ctrl v] pressed?>
I think you've gotten a bit mixed up. It's:
<key [alt/options v] pressed?>
<key [ctrl/cmd v] pressed?>

Welcome to my signature!
I've moved accounts. Anyway, did this post help you? Go follow me on my new account!
Today's Links: Scratch 4.0 Leaked Information, Astronomical - The Third, The Forum Community
follow me on scratch or i am sad, subscribe to my YouTube channel or bad luck for the rest of your life
My Final Shoutout: hekcer because in computer science class, he is the hekcerman
-InsanityPlays- Fan Studio! (closed) | Astronomical - The Third | Best of -InsanityPlays- 2020
my channel, my website, ctrl+shift+down for more STUFF







2020's Advent Collection:

more STUFF
gilbert_given_189
Scratcher
500+ posts

Improving <when key pressed> - More Buttons, Customizable Controls

bump

If you see a line above this text, it means that below this text is my signature.
This place is just a memory to me, I may return occasionally but I'm busy.
I guess I'm an ATer now.

I think I may have seasoned my posts a bit too much.


Colored Pencil is supposed to color the siggy, but Scratch says it's too big.


There is nothing here…



don don pan pan
dondo pan pan

Powered by DjangoBB