Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » "If touching color" doesn't work
- Ben_Ked
-
Teacher
11 posts
"If touching color" doesn't work
Hi,
https://scratch.mit.edu/projects/471405712/editor/
I used the sampling tool to make the program know the color, but the color can't be sensed.
Any idea why?
Greets,
Ben
https://scratch.mit.edu/projects/471405712/editor/
I used the sampling tool to make the program know the color, but the color can't be sensed.
Any idea why?
Greets,
Ben
- notwait
-
Scratcher
100+ posts
"If touching color" doesn't work
It's because that the color on the <touching (#color)> is different than the color in the maze
- Vibrato
-
Scratcher
1000+ posts
"If touching color" doesn't work
try clicking inside the ‘if touching color’ block
and setting the brightness slider to 0. (I see that the lines in the background have brightness 0). It needs to be very exact.
What probably happened was that the eyedropper tool got the edge of the line where it was starting to transition back to white, and it was set to brightness 7 instead.
The other thing you might want to do is put a
otherwise that script will only check if you are touching the color for the first frame once you click the flag. If you put the forever block there, it will keep checking whether you are touching the background lines until you click the stop sign.
Hope I was able to help!
Edit: I took a few minutes to put that all together and another person put a post in a few seconds before me. They are correct. I have explained how to fix the problem as well.
<touching color [#4184d9] ?>^ right here
and setting the brightness slider to 0. (I see that the lines in the background have brightness 0). It needs to be very exact.
What probably happened was that the eyedropper tool got the edge of the line where it was starting to transition back to white, and it was set to brightness 7 instead.
The other thing you might want to do is put a
foreverblock around this script:
end
if <touching color [#000000] ?> then
go to x: (5) y: (140)
end
otherwise that script will only check if you are touching the color for the first frame once you click the flag. If you put the forever block there, it will keep checking whether you are touching the background lines until you click the stop sign.
Hope I was able to help!
Edit: I took a few minutes to put that all together and another person put a post in a few seconds before me. They are correct. I have explained how to fix the problem as well.
Last edited by Vibrato (Jan. 8, 2021 20:03:02)
- Ben_Ked
-
Teacher
11 posts
"If touching color" doesn't work
Hi all,
thanks for your concern and help.
Unfortunately there's no remedy for this bug.
Perhaps I have to draw the walls of the maze inside the program instead of importing them.
Greets,
Ben
thanks for your concern and help.
Unfortunately there's no remedy for this bug.
Perhaps I have to draw the walls of the maze inside the program instead of importing them.
Greets,
Ben
- Vibrato
-
Scratcher
1000+ posts
"If touching color" doesn't work
Hi all,Don't worry, click this
thanks for your concern and help.
Unfortunately there's no remedy for this bug.
Perhaps I have to draw the walls of the maze inside the program instead of importing them.
Greets,
Ben
that will take you to a version of the project that works. me and NotWait have fixed the bug for you
- Discussion Forums
- » Help with Scripts
-
» "If touching color" doesn't work