Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Scratch 2 set pen color and Scratch 3 set pen color
- simonc8
-
46 posts
Scratch 2 set pen color and Scratch 3 set pen color
I have been experimenting with this wonderful shared project, created in 2016:
https://scratch.mit.edu/projects/129394845/
I assume this would have been build using Scratch 2. The bit that puzzles me is the block

x is initially set to -180 and interates until x>180.
This seems to cause the colours to keep cycling round the complete range of hues, with negative numbers presumably wrapped around.
However, if I delete this block and replace it with exactly the same block, but this time within Scratch 3, the effect is quite different: it is interpreting the value of x as a 24 bit binary number with the first 8 bits giving the value of R (0-255) the next 8 G and the last 8 B, so for negative numbers it just produces lightening shades of yellow, and for positive numbers it's mostly black with mimimal amounts of blue.
I have tried the new block

which cycles through the colours (slightly faster) but doesn't have exactly the same starting colour if x = -180.
What has changed about the use of the set pen color block? How can I duplicate the effect of the old pen color block using the new one?
https://scratch.mit.edu/projects/129394845/
I assume this would have been build using Scratch 2. The bit that puzzles me is the block

x is initially set to -180 and interates until x>180.
This seems to cause the colours to keep cycling round the complete range of hues, with negative numbers presumably wrapped around.
However, if I delete this block and replace it with exactly the same block, but this time within Scratch 3, the effect is quite different: it is interpreting the value of x as a 24 bit binary number with the first 8 bits giving the value of R (0-255) the next 8 G and the last 8 B, so for negative numbers it just produces lightening shades of yellow, and for positive numbers it's mostly black with mimimal amounts of blue.
I have tried the new block

which cycles through the colours (slightly faster) but doesn't have exactly the same starting colour if x = -180.
What has changed about the use of the set pen color block? How can I duplicate the effect of the old pen color block using the new one?
Last edited by simonc8 (April 8, 2023 12:08:08)
- awesome-llama
-
1000+ posts
Scratch 2 set pen color and Scratch 3 set pen color
Scratch 2 actually had 2 color blocks:
The top one is still the same block as what is in scratch 3, the bottom one however has now been replaced by the one with a dropdown to set hue (it is confusing that scratch uses “color” to refer to hue).
So comparing these two (for setting hue), the old block has red at multiples of 200 (just like the “color” effect for sprites), the new block is instead multiples of 100. All you would need to do to change to the new block is halve the input value.
set pen color to [#000000]
set pen color to (0)
The top one is still the same block as what is in scratch 3, the bottom one however has now been replaced by the one with a dropdown to set hue (it is confusing that scratch uses “color” to refer to hue).
So comparing these two (for setting hue), the old block has red at multiples of 200 (just like the “color” effect for sprites), the new block is instead multiples of 100. All you would need to do to change to the new block is halve the input value.
set pen color to (0) // old
set pen [color v] to (0)::pen // new
- greenonbeans
-
1 post
Scratch 2 set pen color and Scratch 3 set pen color
can somebody tell me why the set pen to ( ) doesnt work and the other one aswell?
((((

- Discussion Forums
- » Help with Scripts
-
» Scratch 2 set pen color and Scratch 3 set pen color