Discuss Scratch

penguin54
Scratcher
17 posts

Key pressed block

At the moment I am trying to make a basic piano program using the keyboard keys to act as the notes but the script can get really long when using the basic
if <key [a] pressed?> then

set [keypressed] to [a]
end
method so I thought: what if there was a KEY PRESSED block which would output the current key that is being pressed as it would make a lot of scripts shorter!




<keypressed>
ChocolatePi
Scratcher
1000+ posts

Key pressed block

penguin54 wrote:

At the moment I am trying to make a basic piano program using the keyboard keys to act as the notes but the script can get really long when using the basic
if <key [a] pressed?> then

set [keypressed] to [a]
end
method so I thought: what if there was a KEY PRESSED block which would output the current key that is being pressed as it would make a lot of scripts shorter!




<keypressed>
sounds cool!

support
RPFluffy
Scratcher
1000+ posts

Key pressed block

Sure! Support
Zappy1333
Scratcher
100+ posts

Key pressed block

support!
NoMod-Programming
Scratcher
1000+ posts

Key pressed block

Support
Cyoce
Scratcher
500+ posts

Key pressed block

What if you are pressing ≥2 keys at once?
penguin54
Scratcher
17 posts

Key pressed block

Cyoce wrote:

What if you are pressing ≥2 keys at once?
That is true. Well, it could work by outputting the first key pressed?
Langdon35
Scratcher
500+ posts

Key pressed block

Support!

NoMod-Programming wrote:

Support

Zappy1333 wrote:

support!

RPFluffy wrote:

Sure! Support

ChocolatePi wrote:

penguin54 wrote:

At the moment I am trying to make a basic piano program using the keyboard keys to act as the notes but the script can get really long when using the basic
if <key [a] pressed?> then

set [keypressed] to [a]
end
method so I thought: what if there was a KEY PRESSED block which would output the current key that is being pressed as it would make a lot of scripts shorter!




<keypressed>
sounds cool!

support
QuoStrike
Scratcher
32 posts

Key pressed block

I do support, though, I could make a custom block for you guys and post it in a project. All you would have to do is to slide it into your backpack slide it to your project, then make a keypressed variable. I figure you could use that instead.
VoltageGames
Scratcher
1000+ posts

Key pressed block

Support if it allows TAB, ENTER, SHIFT and BACKSPACE/DELETE, but it might confuse new scratchers with the input.
Shift + Click
<key [ v] pressed?>
to get this new block, and Shift + Click to go back.
penguin54
Scratcher
17 posts

Key pressed block

QuoStrike wrote:

I do support, though, I could make a custom block for you guys and post it in a project. All you would have to do is to slide it into your backpack slide it to your project, then make a keypressed variable. I figure you could use that instead.
Thanks! Sounds cool!

Powered by DjangoBB