Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » is there a way to find the color the sprite is touching?
- cooldude12547REBORN
- Scratcher
16 posts
is there a way to find the color the sprite is touching?
i want to know, is it possible? is it possible to make a custom block that sets a variable to the color code of the color that the sprite is touching?
- deck26
- Scratcher
1000+ posts
is there a way to find the color the sprite is touching?
Possible but very slow. Much better to limit the range of colours to a small set.
- cooldude12547REBORN
- Scratcher
16 posts
is there a way to find the color the sprite is touching?
u see, im kinda working on a project that gets info from the webcam, and sends it through cloud data. i was thinking of making a thing that detects if its touching a certain color code, and if not, move to a different color code. like this:
if <touching color [1] ?> then
else
if <touching color [2] ?> then
else
end
end
- gtoal
- Scratcher
1000+ posts
is there a way to find the color the sprite is touching?
finding an arbitrary colour is not the same problem as testing for one in a small list of specific colours. Which is it you need to do?
- cooldude12547REBORN
- Scratcher
16 posts
is there a way to find the color the sprite is touching?
im making something that stored info from the webcam so that it can be stored with cloud data
- deck26
- Scratcher
1000+ posts
is there a way to find the color the sprite is touching?
You've said that. The point remains the same - detecting a small set of colours is still much easier than detecting whatever colour is being touched by your sprite. im making something that stored info from the webcam so that it can be stored with cloud data
Think about the number of pixels and the number of colours. These numbers multiply up very quickly so what numbers are you thinking of?
- cooldude12547REBORN
- Scratcher
16 posts
is there a way to find the color the sprite is touching?
im thinking of something that goes through every possible color code for every pixel on the screen, then gets sent to the server via cloud data, and gets rendered with pen on another computer. kinda like omegle or chat roulette.
- cooldude12547REBORN
- Scratcher
16 posts
is there a way to find the color the sprite is touching?
i kinda want it to run fast, cause im working on video chat in scratch.
(adjacent color)
- gtoal
- Scratcher
1000+ posts
is there a way to find the color the sprite is touching?
Wel, … it won't. It takes minutes per frame. So find something else to work on. i kinda want it to run fast, cause im working on video chat in scratch.(adjacent color)
- cooldude12547REBORN
- Scratcher
16 posts
is there a way to find the color the sprite is touching?
meh ill just have it run slow. its better than nothing.
- cooldude12547REBORN
- Scratcher
16 posts
is there a way to find the color the sprite is touching?
what i was thinking of doing was this:
repeat until <(touchingcolor) = [true]>
if <touching color (color) ?> then
set (touchingcolor) to [true]
else
change (color) by (1)
end
end
- DaEpikDude
- Scratcher
1000+ posts
is there a way to find the color the sprite is touching?
Weeeeeeeeell if you REALLY want to do that it'd take at absolute most 65535 checks to do it. what i was thinking of doing was this:repeat until <(touchingcolor) = [true]>
if <touching color (color) ?> then
set (touchingcolor) to [true]
else
change (color) by (1)
end
end
Better put it in a custom block.
And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
- cooldude12547REBORN
- Scratcher
16 posts
is there a way to find the color the sprite is touching?
Weeeeeeeeell if you REALLY want to do that it'd take at absolute most 65535 checks to do it. what i was thinking of doing was this:repeat until <(touchingcolor) = [true]>
if <touching color (color) ?> then
set (touchingcolor) to [true]
else
change (color) by (1)
end
end
Better put it in a custom block.
how long would it be to do 65535 checks? and if its a long time, is there any way to do it quicker?
- DaEpikDude
- Scratcher
1000+ posts
is there a way to find the color the sprite is touching?
1: A long time.Weeeeeeeeell if you REALLY want to do that it'd take at absolute most 65535 checks to do it. what i was thinking of doing was this:repeat until <(touchingcolor) = [true]>
if <touching color (color) ?> then
set (touchingcolor) to [true]
else
change (color) by (1)
end
end
Better put it in a custom block.
how long would it be to do 65535 checks? and if its a long time, is there any way to do it quicker?
2: Not unless you want it to be inaccurate and occasionally not work.
And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
- cooldude12547REBORN
- Scratcher
16 posts
is there a way to find the color the sprite is touching?
what do u mean by “a long time”? do u mean more than an hour?
- DaEpikDude
- Scratcher
1000+ posts
is there a way to find the color the sprite is touching?
Well, not if you put run without screen refresh, but maybe at most like a minute or something? what do u mean by “a long time”? do u mean more than an hour?
And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
- DaEpikDude
- Scratcher
1000+ posts
is there a way to find the color the sprite is touching?
Note: I actually got it wrong, at maximum it'd run through about 17,000,000 numbers.
And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
- deck26
- Scratcher
1000+ posts
is there a way to find the color the sprite is touching?
Read the topic I linked to, max colours to check is something like 32x 32 x 16. So nowhere near the number you give. Scratch can't recognise that many different colours in a touching block. Note: I actually got it wrong, at maximum it'd run through about 17,000,000 numbers.
- Discussion Forums
- » Help with Scripts
- » is there a way to find the color the sprite is touching?