{"id":6635,"date":"2020-06-20T17:35:11","date_gmt":"2020-06-20T22:35:11","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=6635"},"modified":"2020-06-29T10:07:56","modified_gmt":"2020-06-29T15:07:56","slug":"scratch-touching-clones","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=6635","title":{"rendered":"Scratch \u2013 Touching Clones"},"content":{"rendered":"<p>While you can detect when a clone is touching a main sprite, there\u2019s no way to detect if something is touching a clone. The workaround is to use broadcast messages to trigger events.<\/p>\n<p>1. In the clone, create an \u201cif touching\u201d block to detect when it is being touched by the sprite<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"490\" height=\"450\" class=\"wp-image-6636\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2020\/06\/word-image.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2020\/06\/word-image.png 490w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2020\/06\/word-image-300x276.png 300w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><\/p>\n<p>2. Within the if-touching block, send a broadcast message (under the \u201cEvents\u201d blocks)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"506\" height=\"261\" class=\"wp-image-6637\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2020\/06\/word-image-1.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2020\/06\/word-image-1.png 506w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2020\/06\/word-image-1-300x155.png 300w\" sizes=\"auto, (max-width: 506px) 100vw, 506px\" \/><\/p>\n<p>3. On the other sprite, create a block triggered by the \u201cI receive\u201d event for the code you want to run when this sprite touches the clone of another sprite.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6638 size-full\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2020\/06\/word-image-2.png\" alt=\"\" width=\"254\" height=\"157\" \/><\/p>\n<p>4. Now a sprite executes the desired code when it is touching the clone of another sprite.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While you can detect when a clone is touching a main sprite, there\u2019s no way to detect if something is touching a clone. The workaround is to use broadcast messages to trigger events. 1. In the clone, create an \u201cif touching\u201d block to detect when it is being touched by the sprite 2. Within the &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1040],"tags":[996],"class_list":["post-6635","post","type-post","status-publish","format-standard","hentry","category-scratch","tag-scratch"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/6635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6635"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/6635\/revisions"}],"predecessor-version":[{"id":6639,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/6635\/revisions\/6639"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}