Discuss Scratch
- Discussion Forums
- » Suggestions
- » "Color touching" - Block
- Skayo
-
16 posts
"Color touching" - Block
Please add the “Color touching” - Block!
I would be VERY usefull.
It should look something like this:
To avoid errors, it tests the color at the middle of a Sprite
Here is an example:
)
Please add it
Skayo
PS: If you know a Workaround, please post. Thanks
I would be VERY usefull.
It should look something like this:
<color touching>It outputs the color, the Sprite is currently touching.
To avoid errors, it tests the color at the middle of a Sprite
Here is an example:
when green flag clickedWith this Script you COULD take a Photo (maybe
pen down
turn video [on v]
go to x: (-240) y: (-179)
turn ccw (90) degrees
forever
set pen color to (color touching)
move (1) steps
if <<(y position) = [180]> or <(y position) = [-180]> > then
turn cw (180) degrees
change x by (1)
end
end

Please add it
Skayo
PS: If you know a Workaround, please post. Thanks
Last edited by Skayo (Feb. 19, 2016 16:25:50)
- fredfish10
-
100+ posts
"Color touching" - Block
<color [#00ff00] is touching [#0000ff] ?><touching color [#ff0088] ?>
use these ^
|
- Skayo
-
16 posts
"Color touching" - Block
<color [#00ff00] is touching [#0000ff] ?><touching color [#ff0088] ?>
use these ^
|
Uhm, what do yo mean.
Last edited by Skayo (Feb. 19, 2016 16:28:48)
- fredfish10
-
100+ posts
"Color touching" - Block
I mean that we already have blocks that can solve your problem look at this:
when green flag clicked
forever
if <touching color [#ff0088] ?> then
set [color v] to [pink ]
end
end
- MajesticB
-
500+ posts
"Color touching" - Block
<color [#00ff00] is touching [#0000ff] ?><touching color [#ff0088] ?>
Your script works like this:when green flag clickedWith this Script you COULD take a Photo (maybe
pen down
turn video [on v]
go to x: (-240) y: (-179)
turn ccw (90) degrees
forever
set pen color to <touching color [#ff0088] ?>
move (1) steps
if <<(y position) = [180]> or <(y position) = [-180]> > then
turn cw (180) degrees
change x by (1)
end
end)
Please add it
Skayo
PS: If you know a Workaround, please post. Thanks
- alexphan
-
1000+ posts
"Color touching" - Block
I mean that we already have blocks that can solve your problem look at this:when green flag clicked
forever
if <touching color [#ff0088] ?> then
set [color v] to [pink ]
end
end
But there's millions of colors in the spectrum, so you're not going to put every single possible color into one script, are you?

- Sheep_tester
-
500+ posts
"Color touching" - Block
Ahem, Scratch's touching color block is not exact…I mean that we already have blocks that can solve your problem look at this:when green flag clicked
forever
if <touching color [#ff0088] ?> then
set [color v] to [pink ]
end
end
But there's millions of colors in the spectrum, so you're not going to put every single possible color into one script, are you?
Anyways support for
(color at x:(0) y:(0)::sensing) // inputs default to sprite's current positionwhich returns the color in decimal.
- Skayo
-
16 posts
"Color touching" - Block
Intersesting Block idea! SupportAhem, Scratch's touching color block is not exact…I mean that we already have blocks that can solve your problem look at this:when green flag clicked
forever
if <touching color [#ff0088] ?> then
set [color v] to [pink ]
end
end
But there's millions of colors in the spectrum, so you're not going to put every single possible color into one script, are you?
Anyways support for(color at x:(0) y:(0)::sensing) // inputs default to sprite's current positionwhich returns the color in decimal.
- asivi
-
1000+ posts
"Color touching" - Block
It works only if the entire costume has the same color in order to detect collision properly.Ahem, Scratch's touching color block is not exact…I mean that we already have blocks that can solve your problem look at this:when green flag clicked
forever
if <touching color [#ff0088] ?> then
set [color v] to [pink ]
end
end
But there's millions of colors in the spectrum, so you're not going to put every single possible color into one script, are you?
Anyways support for(color at x:(0) y:(0)::sensing) // inputs default to sprite's current positionwhich returns the color in decimal.
Yes, there's millions of colors in the spectrum but is supposed that the color to choose is in the stage and you can pick it with the cursor.
If you set the pen color this way you only can set the size pen to 1 if the size is higher than 1 has no sense put your block inside a forever loop moving the pen 1 step. Please add the “Color touching” - Block!
I would be VERY usefull.
It should look something like this:<color touching>It outputs the color, the Sprite is currently touching.
To avoid errors, it tests the color at the middle of a Sprite
Here is an example:when green flag clickedWith this Script you COULD take a Photo (maybe
pen down
turn video [on v]
go to x: (-240) y: (-179)
turn ccw (90) degrees
forever
set pen color to (color touching)
move (1) steps
if <<(y position) = [180]> or <(y position) = [-180]> > then
turn cw (180) degrees
change x by (1)
end
end)
Please add it
Skayo
PS: If you know a Workaround, please post. Thanks
Regards.
- Blobfish_Times
-
48 posts
"Color touching" - Block
Support. Although there is technically a workaround, it is very slow, and can't detect every color
There is also a similar way that involves putting every detectable color in a list.
define color touched
set [color v] to [0]
repeat (32)
repeat (32)
repeat (16)
if <touching color (color) ?> then
set [touchedColor v] to [(color)]
stop [this script v]
end
change [color v] by (16)
end
change [color v] by (1792)
end
change [color v] by (458752)
end
There is also a similar way that involves putting every detectable color in a list.
Last edited by Blobfish_Times (April 6, 2021 16:05:26)
- Discussion Forums
- » Suggestions
-
» "Color touching" - Block