m (Example Uses)
Line 28: Line 28:
 
In [[Project|projects]] that use the pen, the pen ''must'' have a certain color (no transparency allowed) {{-}} this block can change it.
 
In [[Project|projects]] that use the pen, the pen ''must'' have a certain color (no transparency allowed) {{-}} this block can change it.
  
Some common uses for the '''Change Pen Color by ()''' block:
+
Some common uses for the '''Change Pen Color by ()''' block are:
 
*Iterating through the pen color values while the pen is being used to create colorful art
 
*Iterating through the pen color values while the pen is being used to create colorful art
  
<scratchblocks>forever if <((timer) mod (1)) = [0]>
+
<scratchblocks>
change pen color by (1)</scratchblocks>
+
forever if <((timer) mod (1)) = [0]>
 +
change pen color by (1)
 +
</scratchblocks>
  
 
*Varying pen colors for an art program
 
*Varying pen colors for an art program
  
<scratchblocks>forever if <loud?>
+
<scratchblocks>
change pen color by (10)
+
forever
wait (2) secs</scratchblocks>
+
change pen color by (loudness)
 +
wait (2) secs
 +
</scratchblocks>
  
 
*In projects that "draw" objects with the pen, changing the color of the object(s)
 
*In projects that "draw" objects with the pen, changing the color of the object(s)
  
<scratchblocks>repeat (360)
+
<scratchblocks>
 +
repeat (360)
 
move (1) steps
 
move (1) steps
 
turn cw (1) degrees
 
turn cw (1) degrees
 
change pen color by ((2) / (3.6))
 
change pen color by ((2) / (3.6))
end</scratchblocks>
+
end
 +
</scratchblocks>
  
 
==See Also==
 
==See Also==

Revision as of 04:12, 21 September 2013

Change Pen Color by ()
2.0 Change Pen Color by ().png
Category Pen
Type Stack
The Change Pen Color by () block is a Pen block and a Stack block. The block increments or decrements the pen's color by the specified value. The color value holds 199 different values of colors, so the 200th pen color value is the same color as a 0 pen color value. In other words, if you change the pen color by 200, the color will remain unchanged.

Workaround

This block cannot be replicated with other Scratch blocks, due to the fact that there is no block that holds the pen color.

However, if the block existed, the Change Pen Color by () block could be replicated with the following code:

set pen color to ((pen color) + (amount))

Nevertheless, that is how Scratch itself does it internally.

If one chooses to, one can have a workaround; but that requires the entire project to be changed block by block. A variable called "pen color" must be created, then the following script needs to be made:

when gf clicked
forever
set pen color to (pen color)

Then to set the pen color, one uses the Set variable block and to change it, one uses the change variable block.

Example Uses

In projects that use the pen, the pen must have a certain color (no transparency allowed) — this block can change it.

Some common uses for the Change Pen Color by () block are:

  • Iterating through the pen color values while the pen is being used to create colorful art
forever if <((timer) mod (1)) = [0]>
change pen color by (1)
  • Varying pen colors for an art program
forever
change pen color by (loudness)
wait (2) secs
  • In projects that "draw" objects with the pen, changing the color of the object(s)
repeat (360)
move (1) steps
turn cw (1) degrees
change pen color by ((2) / (3.6))
end

See Also

Document stub.png This page no longer has any use and needs to be deleted. The user who added this template does not have permission to delete the page. (Date?)
Reason for deletion: Template:Pen Extension should be moved here as this is the standard name
Admins and Experienced Wikians: remember to check the page history, what links here, patrol all unpatrolled edits, then delete this page.
#REDIRECT Template:Pen Extension