Reading a Point's Color
CreatiCode last edited by info-creaticode
When you click on the color input, you can use the color picker tool to get the exact color value at any point you click.
You can actually do this using a block, which would allow your program to “scan” the stage automatically.
To read the color value at any position on the stage, you can use this block:
The first 2 inputs are the X and Y positions of the point you would like to read. For example, if you want to know the color at the center point of the stage, then you should input 0 for both inputs.
Each type of color is actually represented by 4 numbers: color, brightness, saturation and transparency. Before you use this block, you need to first define 4 variables, and then select them in the 4 dropdowns of this block.
After you run this block, these 4 variables will contain the 4 numbers that represent a color.
As shown, we first manually read the brown color at the center of the stage using the color picker tool, which gives us these values: color = 9, saturation = 81, brightness = 60, transparency = 0.
Next, we use the “read color” block, which will store the same 4 numbers into the 4 variables: color = 9, saturation = 81, brightness = 60, transparency = 0.