Discuss Scratch

WoodsSilent05
Scratcher
9 posts

Copying Colors From Costumes To Be Used By The Pen Addon.

Heya, I'm wondering if anyone has already found a way to copy colors from a costume to be used by the pen.
Or maybe a way to copy *some* color, if anyone already knows a way, please tell me!!
dragonsnake003
Scratcher
100+ posts

Copying Colors From Costumes To Be Used By The Pen Addon.

WoodsSilent05 wrote:

Heya, I'm wondering if anyone has already found a way to copy colors from a costume to be used by the pen.
Or maybe a way to copy *some* color, if anyone already knows a way, please tell me!!
There isn't any quick way to use this, but Python is a great resource for things like this. You can scan each pixel from top row to bottom and transfer the color into a number. Then take each number and put it into a Scratch stored list. You can then (in Scratch) code the pen to do the same function as the Python script, and have it go 480 pixels across, 360 pixels down. Then have the pen color be set to the item # of the pixel in the color list. If you don't know Python, there is always templates available on the internet for these types of things. Hope this helps!
Scratch137
Scratcher
1000+ posts

Copying Colors From Costumes To Be Used By The Pen Addon.

The colour selector in the “set pen color to” block has an eyedropper tool.

setpencolorto

You can use the eyedropper to pick a colour from the stage—that includes any sprites that are currently visible.

If you want to have a script that automatically picks a colour from the current costume, this is unfortunately impossible to do in Scratch without picking every colour manually. Alternatively, as @dragonsnake003 suggested above, you could write a Python program that gets the colour information for you (though this obviously requires some knowledge of Python).
WoodsSilent05
Scratcher
9 posts

Copying Colors From Costumes To Be Used By The Pen Addon.

dragonsnake003 wrote:

[There isn't any quick way to use this, but Python is a great resource for things like this. You can scan each pixel from top row to bottom and transfer the color into a number. Then take each number and put it into a Scratch stored list. You can then (in Scratch) code the pen to do the same function as the Python script, and have it go 480 pixels across, 360 pixels down. Then have the pen color be set to the item # of the pixel in the color list. If you don't know Python, there is always templates available on the internet for these types of things. Hope this helps!

As per what @Scratch137 said with the whole picking every color manually, (which would be 100,000 total combinations, 100x100x100) do you think that Python could make a Scratch 3 file with a giant script of those 100,000 different color detectors, all going to a list, adding the color, saturation and brightness?

(if I wasn't clear enough, {which I am not most of the time lol} then this example should help )
definefindColor;gotox:-240y:180repeat360repeat480changexby1searchForColor;setxto-240changeyby-1definesearchForColor;iftouchingcolor?thenadd7,14,234tolist

The color chosen is just an example.
There would be 100,000 detectors like that.

Also if this somehow helps with anything, I am making a HaxeFlixel simulator in Scratch, and I'm making it so that you can import costumes and turn them into list data, that way, they can make the sprite have custom height and width, stretch the sprite, use spritesheets, etc.
NormalUsername254
Scratcher
5 posts

Copying Colors From Costumes To Be Used By The Pen Addon.

theres a griffpatch tutorial for this! heres the link: https://www.youtube.com/watch?v=3lz1nylUHiY (sorry that the links not clickable, i dont have link perms rn)
WoodsSilent05
Scratcher
9 posts

Copying Colors From Costumes To Be Used By The Pen Addon.

NormalUsername254 wrote:

theres a griffpatch tutorial for this! heres the link: https://www.youtube.com/watch?v=3lz1nylUHiY (sorry that the links not clickable, i dont have link perms rn)

Omg! Thank you so much! This was very helpful! I didn't even know it was possible to use variables in a touching color block, thank you so much!

Powered by DjangoBB