When Key Pressed/Released Blocks
CreatiCode last edited by
The “When () Key Pressed” and “When () Key Released” blocks are Hat Blocks in the Events category.
This block plays the blocks attached below it when the selected key is pressed down on the keyboard.
This block plays the blocks attached below it when the selected key is released (let go) on the keyboard.
To select a different key, click on the drop-down menu of the block, and then select any key from the Keyboard Pop-up.
If you keep holding a key down, the “When ()Key Pressed” block will be played again and again, as if you are pressing down the key repeatedly.
Here is how you can use the “When Key Pressed” and “When Key Released” blocks together to start and stop a sprite’s dancing animation.