Activities/Turtle Art: Difference between revisions
| Line 271: | Line 271: | ||
These blocks are used to control the movements of the turtle. | These blocks are used to control the movements of the turtle. | ||
* forward: move turtle forward | * forward: move turtle forward | ||
* back: move turtle backward | * back: move turtle backward | ||
* | * clean: clear the screen and position the turtle in the center of the screen, pen down, color red, heading 0 | ||
* left: rotate turtle counterclockwise | * left: rotate turtle counterclockwise | ||
* right: rotate turtle clockwise | * right: rotate turtle clockwise | ||
* | * arc: move turtle along an arc | ||
* set xy: set turtle x,y position (0,0) is the center of the screen | * set xy: set turtle x,y position (0,0) is the center of the screen | ||
* | * seth: set turtle heading | ||
* xcor: holds current x-coordinate value of the turtle (can be used in place of a number block) | * xcor: holds current x-coordinate value of the turtle (can be used in place of a number block) | ||
* ycor: holds current y-coordinate value of the turtle (can be used in place of a number block) | * ycor: holds current y-coordinate value of the turtle (can be used in place of a number block) | ||
* | * heading: holds current heading value of the turtle (can be used in place of a number block) | ||
====Pen Palette==== | ====Pen Palette==== | ||
| Line 301: | Line 293: | ||
* fill screen: fill the screen with a color/shade and reposition the turtle in the center of the screen | * fill screen: fill the screen with a color/shade and reposition the turtle in the center of the screen | ||
* pen size: width of the line drawn by the turtle (can be used in place of a number block) | * pen size: width of the line drawn by the turtle (can be used in place of a number block) | ||
* start fill: starts a filled polygon (straight sides, not arcs) | * start fill: starts a filled polygon (straight sides, not arcs) | ||
* end fill: ends a fill polygon (straight sides, not arcs) | * end fill: ends a fill polygon (straight sides, not arcs) | ||
| Line 315: | Line 300: | ||
These blocks can be used with the set-pen-color block in place of a number block. | These blocks can be used with the set-pen-color block in place of a number block. | ||
* set color: sets the pen color | |||
* set shade: sets the pen shade | |||
* set gray: sets the gray-level of the pen (Only available in Turtle Blocks) | |||
* color: current pen color (can be used in place of a number block) | |||
* shade: current pen shade (can be used in place of a number block) | |||
* gray: current pen gray level (can be used in place of a number block) (Only available in Turtle Blocks) | |||
====Numbers Palette==== | ====Numbers Palette==== | ||
| Line 358: | Line 349: | ||
These blocks are for defining variables and subroutines. | These blocks are for defining variables and subroutines. | ||
* | * start: connects action to toolbar 'Run' button | ||
* store in box 1: store a number, string, or media object in box 1 (Only available with Turtle Blocks) | * store in box 1: store a number, string, or media object in box 1 (Only available with Turtle Blocks) | ||
* store in box 2: store a number, string, or media object in box 2 (Only available with Turtle Blocks) | * store in box 2: store a number, string, or media object in box 2 (Only available with Turtle Blocks) | ||
| Line 371: | Line 357: | ||
* box: current value of named box (can be used in place of a number block) | * box: current value of named box (can be used in place of a number block) | ||
* store in: store a number, string, or media object in a named box | * store in: store a number, string, or media object in a named box | ||
* | * action: top of named action stack | ||
* action 1: top of action 1 stack (Only available with Turtle Blocks) | |||
* action 2: top of action 2 stack (Only available with Turtle Blocks) | |||
* action: execute named action stack | |||
* action 2: execute action 2 stack (Only available with Turtle Blocks) | |||
* action 1: execute action 1 stack (Only available with Turtle Blocks) | |||
====Media Palette==== | ====Media Palette==== | ||
| Line 377: | Line 368: | ||
These are a collection of blocks used for displaying media objects, such as images from the Journal. | These are a collection of blocks used for displaying media objects, such as images from the Journal. | ||
* journal: Sugar Journal media object (used with show block) (also available in Turtle Art) | |||
* audio: Sugar Journal media object (used with show block) | |||
* video: Sugar Journal media object (used with show block) | |||
* description: Sugar Journal description field (used with show block) | |||
* text: text string (used with show block; also used with box and action blocks) | |||
* show: draw text or display media object from the Journal | |||
* set scale: sets the scale of images displayed with show block | |||
* save picture: save the canvas to the Sugar Journal as a .png image (note: saves the canvas as displayed) | |||
* save SVG: save turtle graphics to the Sugar Journal as a .svg image (note: only saves the changes to the canvas in the current execution run) | |||
* scale: sets scale for show block (100% is full-screen) | |||
* wait for media: used to pause program while audio or video file plays | |||
====Sensors Palette==== | ====Sensors Palette==== | ||
| Line 385: | Line 388: | ||
* read pixel: push the RGB value of the pixel under the turtle onto the FILO (blue is first, red is last) | * read pixel: push the RGB value of the pixel under the turtle onto the FILO (blue is first, red is last) | ||
* turtle sees: the "palette color" of the pixel under the turtle | * turtle sees: the "palette color" of the pixel under the turtle | ||
* time: number of seconds since program began | |||
* sound: raw data from microphone ranging -32000 to 32000 | * sound: raw data from microphone ranging -32000 to 32000 | ||
* volume: ranging 0 to 32000 | * volume (loudness): ranging 0 to 32000 | ||
* pitch: the resolution is +-8Hz | * pitch: the resolution is +-8Hz | ||
* brightness: average luminance seen through camera | |||
* camera: grab image from camera | |||
The OLPC XO can measure external inputs with its microphone jack: | The OLPC XO can measure external inputs with its microphone jack: | ||
| Line 403: | Line 409: | ||
* push: push value onto FILO (first-in last-out) heap | * push: push value onto FILO (first-in last-out) heap | ||
* show heap: show FILO in status block | * show heap: show FILO in status block | ||
* empty heap: empty the FILO | * empty heap: empty the FILO | ||
* pop: pop value off of the FILO (can be used in place of a number block) | |||
* print: print value in status block (also available in Turtle Art) | |||
* comment: program comment (displayed in "walk" mode) | |||
* Python: a [[Activities/TurtleArt-0.88#Python_function_block|programmable block]] (can be used in place of a number block) | * Python: a [[Activities/TurtleArt-0.88#Python_function_block|programmable block]] (can be used in place of a number block) | ||
:: add your own math equation in the block, e.g., sin(x); This block is expandable to support up to three variables, e.g. f(x,y,z) | :: add your own math equation in the block, e.g., sin(x); This block is expandable to support up to three variables, e.g. f(x,y,z) | ||
* Import Python: [[Activities/TurtleArt-0.88#Python_code_block|import Python code]] from the Sugar Journal (a more general-purpose programmable block). This block accepts a single variable x, as an input or up to 3 variables as an array x[0], x[1] and x[2] | * Import Python: [[Activities/TurtleArt-0.88#Python_code_block|import Python code]] from the Sugar Journal (a more general-purpose programmable block). This block accepts a single variable x, as an input or up to 3 variables as an array x[0], x[1] and x[2] | ||
* Cartesian: display Cartesian coordinate grid overlay | * Cartesian: display Cartesian coordinate grid overlay | ||
* polar: display polar coordinate grid overlay | * polar: display polar coordinate grid overlay | ||
* turtle: specify which turtle is active | * turtle: specify which turtle is active | ||
* turtle shell: import a image from the Journal to use as the turtle's 'shell', i.e., replace the turtle with a sprite. | * turtle shell: import a image from the Journal to use as the turtle's 'shell', i.e., replace the turtle with a sprite. | ||
| Line 426: | Line 430: | ||
These blocks are used to make multimedia presentations only available in Turtle Blocks. | These blocks are used to make multimedia presentations only available in Turtle Blocks. | ||
* hide blocks: hides all blocks and palettes (useful for decluttering the screen during presentations) (also available in Turtle Art) | * hide blocks: hides all blocks and palettes (useful for decluttering the screen during presentations) (also available in Turtle Art) | ||
* show blocks: shows blocks and palettes (useful for resuming programming after a presentation) | * show blocks: shows blocks and palettes (useful for resuming programming after a presentation) | ||
* full screen: goes into full-screen mode (hides Sugar toolbars) | * full screen: goes into full-screen mode (hides Sugar toolbars) | ||
* list slide: used for bulleted lists; This block is expandable, allowing you to add as many bullets as you need | * list slide: used for bulleted lists; This block is expandable, allowing you to add as many bullets as you need | ||
* picture slides: used for picture slides (1×1, 2×2, 1×2, and 2×1) | * picture slides: used for picture slides (1×1, 2×2, 1×2, and 2×1) | ||
Only available in Turtle Blocks: | |||
* left: holds current x-coordinate value of the left edge of the screen (can be used in place of a number block) | |||
* top: holds current y-coordinate value of the top edge of the screen (can be used in place of a number block) | |||
* right: holds current x-coordinate value of the right edge of the screen (can be used in place of a number block) | |||
* bottom: holds current y-coordinate value of the bottom edge of the screen (can be used in place of a number block) | |||
* width: screen width (can be used in place of a number block) | |||
* height: screen height (can be used in place of a number block) | |||
::Note: The slide blocks expand into stacks that can be edited for customized presentations. | ::Note: The slide blocks expand into stacks that can be edited for customized presentations. | ||