BITMAPTURTLE

Synopsis
BITMAPTURTLE
(BITMAPTURTLE rotatebitmap)
Description

Maps the current turtle (see SETTURTLE) to the corresponding bitmap buffer (see BITCUT). BITMAPTURTLE can map turtle 0 to bitmap 0, turtle 1 to bitmap 1, turtle 2 to bitmap 2, etc., on a per-turtle basis. Note that there is no way to map a turtle to any bitmap index other than the turtle's index. For example, turtle 2 can only be mapped to bitmap 2, not bitmap 1 or bitmap 3.

Because bitmap 0 is always mapped to the clipboard, BITMAPTURTLE can only map turtle 0 to the clipboard. That is, if you select turtle 0 and run BITMAPTURTLE, then the turtle changes to whatever is in the clipboard and is updated whenever the clipboard subsequently changes. FMSLogo complains if the clipboard is not holding an image while turtle 0 is bitmapped.

Both NOBITMAPTURTLE and CLEARSCREEN restores the turtle to its normal shape, but does not erase the corresponding bitmap.

If the optional rotatebitmap input is TRUE, then the bitmap rotates with the turtle's heading. If the rotatebitmap input is not given, it defaults to FALSE. This must be either TRUE or FALSE.

A turtle with a rotating bitmap treats all white pixels in the bitmap as transparent. There is no way to show white pixels in a rotating bitmap, but you can instead use nearly white pixels that look white, such as a very light grey. Neither turtle 0 (the clipboard bitmap), nor any of the special turtles, can be bitmapped using a rotating bitmap.

A turtle with a rotating bitmap draws the center of the bitmap at the turtle's position. A turtle with a non-rotating bitmap keeps the lower-left corner of the bitmap at the turtle's position.

Example

The following example shows a regular bitmapped turtle that traces a circle.

CLEARSCREEN
LABEL "+
SETBITINDEX 1
BITCUT 20 20
HIDETURTLE
SETTURTLE 1
BITMAPTURTLE
REPEAT 360 [ FORWARD 1 RIGHT 1 WAIT 1 ]

The following example shows a turtle with a rotating bitmap that traces a circle on a blue background.

SETSCREENCOLOR "WHITE
CLEARSCREEN
LABEL "+
SETBITINDEX 1
BITCUT 20 20
HIDETURTLE
SETTURTLE 1
SETSCREENCOLOR "BLUE
(BITMAPTURTLE "TRUE)
REPEAT 360 [ FORWARD 1 RIGHT 1 WAIT 1 ]


SourceForge.net Logo