Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Touching Parameters
- Cool_Dude2022
-
Scratcher
500+ posts
Touching Parameters
I am creating this post for @4lex4ndre. He has an issue where he's getting a true reading when it's supposed to be false. Before you comment “Just use the <not <>> block,” read the entire topic.
Original Post
Here's the COLLISION TEST and read the instructions below:
TEST 1: the entities must “touch” each other BEHIND the red square (BACK / BACK) If you're wondering what this is, you need to switch the "go to layer“ blocks. The left one (back) goes to the ”when green flag clicked“ script, and the right one (back) goes to the ”when I start as clone" script.
TEST 2: the entities must “touch” each other IN FRONT OF the red square (FRONT / FRONT)
TEST 3: the entities must NOT “touch” each other THROUGH the red square (BACK / FRONT)
TEST 4: the entities must NOT “touch” each other THROUGH the red square (FRONT / BACK)
These are the tests that we have conducted using the <touching ()?> block and also the <touching color ()?> block:
<touching (entity)?>:
back/back = true (passed)
front/front = true (passed)
back/front = true (failed)
front/back = true (failed)
<touching color (black)?]>:
back/back = false (failed)
front/front = true (passed)
back/front = true (failed)
front/back = false (passed)
I've noticed that we need another boolean that passes the back/front check, this is due to the fact that none of the booleans that we have used have passed this test. We might also need a new check for the front/front & back/front checks as they are true at the same time. But I'm mainly focusing on the back/front check as of right now.
Original Post
Here's the COLLISION TEST and read the instructions below:
TEST 1: the entities must “touch” each other BEHIND the red square (BACK / BACK) If you're wondering what this is, you need to switch the "go to layer“ blocks. The left one (back) goes to the ”when green flag clicked“ script, and the right one (back) goes to the ”when I start as clone" script.
TEST 2: the entities must “touch” each other IN FRONT OF the red square (FRONT / FRONT)
TEST 3: the entities must NOT “touch” each other THROUGH the red square (BACK / FRONT)
TEST 4: the entities must NOT “touch” each other THROUGH the red square (FRONT / BACK)
These are the tests that we have conducted using the <touching ()?> block and also the <touching color ()?> block:
<touching (entity)?>:
back/back = true (passed)
front/front = true (passed)
back/front = true (failed)
front/back = true (failed)
<touching color (black)?]>:
back/back = false (failed)
front/front = true (passed)
back/front = true (failed)
front/back = false (passed)
I've noticed that we need another boolean that passes the back/front check, this is due to the fact that none of the booleans that we have used have passed this test. We might also need a new check for the front/front & back/front checks as they are true at the same time. But I'm mainly focusing on the back/front check as of right now.
- 4lex4ndre
-
Scratcher
62 posts
Touching Parameters
Actually using 2 different sprites clones.
It work well, and surprisely, my code seems proper. I already have some cleaning but it's already useable
Thanks for all your help
if someone is searching how to detect touching own clone, you have to go in a different sprite, create and set the block :
and then drag this block in the sprite1
It work well, and surprisely, my code seems proper. I already have some cleaning but it's already useable
Thanks for all your help

if someone is searching how to detect touching own clone, you have to go in a different sprite, create and set the block :
<touching [sprite 1 v] ?>
and then drag this block in the sprite1

Last edited by 4lex4ndre (Feb. 9, 2024 15:36:21)
- Cool_Dude2022
-
Scratcher
500+ posts
Touching Parameters
Actually using 2 different sprites clones.
It work well, and surprisely, my code seems proper. I already have some cleaning but it's already useable
Thanks for all your help
if someone is searching how to detect touching own clone, you have to go in a different sprite, create and set the block :<touching [sprite 1 v] ?>
and then drag this block in the sprite1
The code still doesn't seem to work.
- 4lex4ndre
-
Scratcher
62 posts
Touching Parameters
You mean the COLLISION TEST ?
I didn't modify it at this moment, i'm talking about the final project
In my project, BACK and FRONT are 2 differents sprites. Clones are touching each other, but not if different sprite
I didn't modify it at this moment, i'm talking about the final project

In my project, BACK and FRONT are 2 differents sprites. Clones are touching each other, but not if different sprite
Last edited by 4lex4ndre (Feb. 9, 2024 15:56:13)
- Discussion Forums
- » Help with Scripts
-
» Touching Parameters