<?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[The &quot;Distance between&quot; Operator Block]]></title><description><![CDATA[<p dir="auto"> </p>
<h2><a class="anchor-offset" name="prerequisite"></a>Prerequisite</h2>
<ul>
<li><a href="/topic/73/working-with-blocks">Working with Blocks</a></li>
</ul>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="what-is-direct-and-manhattan-distance"></a>What is “Direct” and “Manhattan” distance?</h2>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/7c2bf897-310e-49a5-a88d-d5bc45d22cf5.PNG" width="700" /></p>
<p dir="auto">Suppose you are at the start point on the map above, and you want to travel to the stop point. If you can walk in a straight line, then the length of this line is the direct distance between these 2 points. This is shown as the yellow line on the map.</p>
<p dir="auto">However, in many situations, you can not travel in a straight line. For example, there may be houses or buildings between the street blocks, as in the case of Manhattan city. In this case, you have to walk along the vertical or horizontal streets. The total length of these lines is the “Manhattan distance” between the 2 points.</p>
<p dir="auto">Below are some more examples of Direct and Manhattan distances between the START and STOP points;<br />
 <br />
<strong>Example 1:</strong><br />
<img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/7c2bf897-310e-49a5-a88d-d5bc45d22cf5.PNG" width="700" /><br />
 </p>
<p dir="auto"><strong>Example 2:</strong><br />
<img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/3aa83650-2d56-4dad-8293-604ca1f5c770.PNG" width="700" /><br />
 <br />
<strong>Example 3:</strong><br />
<img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/c582f903-93e1-498c-8865-f0e5cb365722.PNG" width="700" /><br />
 <br />
 </p>
<h2><a class="anchor-offset" name="the-block"></a>The Block</h2>
<p dir="auto">The “Distance between x() y() and x() y()/ direct” is a reporter block in the operators category.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ca0e0d81-1d3b-458b-a193-963da917cd49.PNG" width="850" /><br />
 </p>
<h2><a class="anchor-offset" name="how-does-this-block-work"></a>How does this block work?</h2>
<p dir="auto">This block <strong>tells the distance between two specified points.</strong></p>
<p dir="auto">In CreatiCode, a “point” or “position of a sprite” is defined by an <strong>“x position”</strong> and a <strong>“y position”</strong>. <img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ea06711e-f524-47c4-adf9-9a02aa126a92.PNG" width="600" /></p>
<p dir="auto"> <br />
You need to input the position values of two different points in the block, and choose “Direct” or “Manhattan” by clicking on the drop-down menu. <img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/75638ba4-9fc5-46bf-8c67-84ec8e3b9b02.PNG" width="400" /></p>
<p dir="auto">Here is how it works;</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/6790c144-ce75-4d42-b471-a19a51265261.gif" width="700" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
]]></description><link>https://forum.creaticode.com/topic/666/the-distance-between-operator-block</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 10:49:32 GMT</lastBuildDate><atom:link href="https://forum.creaticode.com/topic/666.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 29 Sep 2022 11:05:15 GMT</pubDate><ttl>60</ttl></channel></rss>