<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[When Key Pressed&#x2F;Released Blocks]]></title><description><![CDATA[<p dir="auto"> </p>
<h2><a class="anchor-offset" name="prerequisite"></a>Prerequisite</h2>
<ul>
<li><a href="/topic/31/working-with-sprites">Working with Sprites</a></li>
</ul>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="description"></a>Description</h2>
<p dir="auto">The “When () Key Pressed” and “When () Key Released” blocks are <strong>Hat Blocks</strong> in the <strong>Events</strong> category.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/105b4a42-56ae-4d60-8d73-c36e8638ba1b.PNG" width="650" /><br />
 </p>
<h3><a class="anchor-offset" name="the-when-key-pressed-block"></a>The When () Key Pressed Block</h3>
<p dir="auto">This block <strong>plays the blocks attached below it</strong> when the selected key is pressed down on the keyboard.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/0d157c07-137a-4ee0-8f33-112c392aaffd.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
<h3><a class="anchor-offset" name="the-when-key-released-block"></a>The When () Key Released Block</h3>
<p dir="auto">This block <strong>plays the blocks attached below it</strong> when the selected key is released (let go) on the keyboard.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/060438c8-bcc1-458b-859a-ceba745f1b1b.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
<h2><a class="anchor-offset" name="how-to-select-different-keys"></a>How to Select Different Keys?</h2>
<p dir="auto">To select a different key, <strong>click on the drop-down menu</strong> of the block, <img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/464157d5-d9ff-486b-80bb-dcd271af8226.PNG" width="170" /> and then <strong>select any key</strong> from the <strong>Keyboard Pop-up.</strong></p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/d7ba2cd2-c26f-4761-a2f5-bb55d32aa468.gif" width="700" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
<h2><a class="anchor-offset" name="what-happens-when-we-keep-a-key-pressed-down"></a>What Happens When We Keep a Key Pressed Down?</h2>
<p dir="auto">If you keep holding a key down, the “When ()Key Pressed” block <strong>will be played again and again</strong>, as if you are pressing down the key repeatedly.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ec2e25a0-8342-4e99-aa83-281fe8c240e6.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
<h2><a class="anchor-offset" name="demo-dance-animation-with-key-pressed-released"></a>Demo: Dance Animation with Key Pressed/Released</h2>
<p dir="auto">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.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/7458b3f4-4238-4a24-bab1-e17cc3e79c81.gif" width="800" style="border-radius:5px;border:1px solid #29622d" /></p>
]]></description><link>https://forum.creaticode.com/topic/120/when-key-pressed-released-blocks</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 23:24:47 GMT</lastBuildDate><atom:link href="https://forum.creaticode.com/topic/120.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 29 Mar 2022 02:39:52 GMT</pubDate><ttl>60</ttl></channel></rss>