Discuss Scratch

Nectanebus0
New Scratcher
5 posts

Touching color sensing block not working consistently

I'm using the touching color block to detect when a main sprite comes in contact with other sprites. When I try to use the touching color sensor, it works completely with one sprite but not another, even though they're exact copies of each other. I did some testing to confirm this anomaly.
Vaibhs11
Scratcher
1000+ posts

Touching color sensing block not working consistently

That block is known in scratch history as the block which never works consistently, you might consider other options…
or you are using clones that might cause some problems

Anyway, please share the project and the link
Nectanebus0
New Scratcher
5 posts

Touching color sensing block not working consistently

Nectanebus0
New Scratcher
5 posts

Touching color sensing block not working consistently

On the blue holder 1 (bottom left blue circle), if you hover the sprite and press e, it should send out clones to mark possible moves, like chess but different. One rule is that it can go 2 squares in the cardinal directions but can't cross on top of two adjacent pieces. That is what the script is trying to accomplish, but it doesn't detect the second piece to the right or any other ones if you drag it across the board to test with different pieces.

Last edited by Nectanebus0 (May 22, 2022 06:23:03)

imfh
Scratcher
1000+ posts

Touching color sensing block not working consistently

Does something like this fix the problem? I'm not entirely sure what it is supposed to do, but this makes it so a green dot doesn't appear on the circle to the right of the bottom left circle when you press e.

I would recommend using more clones and having only 1 Blue Holder sprite. It might be tricky to figure out at first, but it will save you a lot of work trying to copy code between all of the different sprites.

Nectanebus0
New Scratcher
5 posts

Touching color sensing block not working consistently

On +40, it should always place a clone and set blocked to 1 if there's another sprite. On +80 it should always place a clone unless there's a sprite and blocked is 1. It resets blocked to 0 after that.

The color sensing works fine for +40 but not for +80.

Last edited by Nectanebus0 (May 23, 2022 06:15:52)

Nectanebus0
New Scratcher
5 posts

Touching color sensing block not working consistently

If touching color ultimately doesn't work, i just need another method of detecting other sprites. Obviously not a long OR chain with all the sprite's names

A solution with copying is fine because it's extremely easy to copy code

Last edited by Nectanebus0 (May 23, 2022 06:22:12)

Powered by DjangoBB