Drawing > Drawing


Basic

Draw Text

draw-text-block

Draws the specified text to the given location using the current font. Color and stroke settings do not apply to fonts.

g.drawString([TEXT], [NUMBER], [NUMBER]);

Draw Line

draw-line-block

Draws a line from the starting point to the ending point, using the current stroke color and thickness.

g.drawLine([NUMBER], [NUMBER], [NUMBER], [NUMBER]);

Fill Pixel

fill-pixel-block

Draws a single pixel to the given location, using the current color. We recommend using the Image API if you intend to fill many pixels at a time.

g.fillPixel([NUMBER], [NUMBER]);

Actor Drawing

Draw Image for Actor

draw-actor-block

Draws the specified actor's image to the current pen position. Will base this upon the actor's current animation (and current frame). Still works if the actor is hidden. Useful for drawing things behind an actor.

[ACTOR].drawImage(g);

Example

example

Draws the following.

example


Rectangles

Draw Rectangle

draw-rect-block

Draws an outline of (or fills) a rectangle at the specified position and size, using the current stroke color and thickness (and color for filling).

g.drawRect([NUMBER], [NUMBER], [NUMBER], [NUMBER], [NUMBER]);

Draw Rounded Rectangle

draw-round-rect-block

Draws an outline of (or fills) a rounded rectangle at the specified position and size, using the current stroke color and thickness (and color for filling).

g.drawRoundRect([NUMBER], [NUMBER], [NUMBER], [NUMBER], [NUMBER]);

Circles

Draw Circle

draw-circle-block

Draws an outline of (or fills) a circle at the specified position and size, using the current stroke color and thickness (and color for filling).

g.drawCircle([NUMBER], [NUMBER], [NUMBER]);

Polygons

Draw Polygon

draw-poly-block

Draws an outline of (or fills) a polygon at the specified position, using the current stroke color and thickness (and color for filling). Use the add point to polygon block to add points to the polygon.

g.beginDrawPolygon();
[ACTIONS]
g.endDrawingPolygon();

Add Point to Polygon

add-poly-block

Adds the specified point to the polygon. Must be used within the draw a [oulined/filled] polygon wrapper, and at least 3 points must be specified. You do not have to "close" the polygon by repeating the starting point.

g.addPointToPolygon([NUMBER], [NUMBER]);