Drawing > Drawing


Basic

Draw Text

draw text object at x number y number

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 start at x number y number end at x number y number

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 at x number y number

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 image for actor

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 at x number y number with w number h number

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]);
g.fillRect([NUMBER], [NUMBER], [NUMBER], [NUMBER]);

Draw Rounded Rectangle

draw round rect at x number y number with w number h number arc number

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]);
g.fillRoundRect([NUMBER], [NUMBER], [NUMBER], [NUMBER], [NUMBER]);

Circles

Draw Circle

draw circle at center x number y number with radius number

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]);
g.fillCircle([NUMBER], [NUMBER], [NUMBER]);

Polygons

Draw Polygon

draw a outlined polygon

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.

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

//fill
g.beginFillPolygon();
[ACTIONS]
g.endDrawingPolygon();

Add Point to Polygon

add point to polygon x number y number

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]);