Skip to content

Shapes and lines

There are six shapes, and each asks for its own numbers: a corner here, a centre there, a radius elsewhere

easyYou need: The first picture
tick 0
Draw0
rgb
Draw1
rgb
a
Draw2
xy
widthheight
Draw3
xy
widthheight
Draw4
Draw5
xy
x2y2
Draw6
rgb
a
Draw7
xy
sidesradius
rotation
Draw8
xy
sidesradius
rotation
Draw9
xy
x2y2
x3y3
Draw Flush10
Stop11
@counter0number

Everything the display can do is drawn here: a fill and an outline, a line, a hexagon, a triangle in outline and a triangle filled.

Command Fields What it counts from
rect x y width height the bottom left corner
lineRect x y width height the same, but in outline
line x1 y1 x2 y2 point to point
poly x y sides radius rotation from the centre
linePoly x y sides radius rotation the same, in outline
triangle x1 y1 x2 y2 x3 y3 three vertices

That difference in what a shape counts from is the most common cause of “it drew in the wrong place”. For a rectangle it is a corner, for a polygon the centre.

draw stroke 4

stroke sets the thickness of everything drawn in outline: line, lineRect, linePoly. Like the colour, it holds until the next stroke, and it does not affect fills at all.

The fifth field of poly is an angle in degrees, and it is counted as everywhere in mlog: counter-clockwise, with zero pointing right.

draw poly 88 88 3 40 0
draw poly 88 88 3 40 180

Two triangles from the same point, rotated relative to each other — a star. Half the pictures on displays are built on that.

Unofficial fan project, not affiliated with Anuke. Mindustry sprites, fonts and translations © Anuke, used under GPL-3.0; Fira Code under OFL-1.1. Site code is GPL-3.0.