Skip to content

1. Graphics

fowluhhdevbcfunny edited this page Jun 17, 2024 · 3 revisions

To draw graphics you must know how to use the classes.

LineShape: used as:

new LineShape(point1, point2, line_width, line_color)

NOTE: Point 1 and 2 are Points

RectangleShape: used as:

new RectangleShape(x, y, width, height, color)

OutlinedRectangleShape: used as:

new OutlinedRectangleShape(x, y, width, height, color, outline_color, outline_width)

Sprite: used as:

new Sprite(source, x, y, scale=1)

TextLabel: used as:

new TextLabel(text, x, y, color, font)

NOTE: Font is a Font class. Use it like so:

new Font(size, name)

OutlinedTextLabel: used as:

new OutlinedTextLabel(text, x, y, color, outline_color, outline_width, font)

TileMap: used as:

new TileMap(data, tilesize, offset_x, offset_y)

NOTE: TileMap data must be organized like so:

[
    [ 0, 1, 0, 1 ],
    [ 1, 0, 1, 0 ],
    [ 0, 1, 0, 1 ],
    [ 1, 0, 1, 0 ]
]

and tiles must be added IN ORDER like so:

this.tilemap.addTile("path/to/your/tile.png");

To add graphics, call this.add(gfx) in your scene.

Clone this wiki locally