Drawings
Draw the pitch, the players and the ball with shapes that follow discs, and choose who sees each one.
The world's discs and walls have no look of their own. What players see is what your game draws: shapes that sit on the field or follow a disc.
Draw the pitch
world.draw makes a shape. Shapes belong to the match, so draw them when it
starts:
| Shape | Draws |
|---|---|
circle | a circle, or a disc's body when anchored |
box | a rectangle, with rounded corners |
polygon | a closed outline through its points |
line | a line through its points, with arrows |
arc | part of a circle's outline |
text | a label that stays upright |
image | an image from your package |
group | the shapes inside it, moved together |
Every shape takes a position, rotation, scale, fill, stroke,
strokeWidth, dash and opacity. A shape without fill is hollow; one
without stroke has no outline.
Follow a disc
With an anchor, a shape moves with a disc. A circle without a radius
takes the disc's. A group keeps shapes together and in order: later shapes
are drawn on top.
Each shape can have an audience: the ring above reaches only its own player.
When a disc is destroyed, the shapes that follow it go too.
Colours
rgb, rgba, hsl and hsla make colours. disko:color mixes them:
mix, lighten, darken and withAlpha. The same colours work in chat
and in Menu and HUD styles.
Move every frame
Any number can be an expression that every screen works out on each frame, so a shape can spin, pulse or fade with no code in your tick handler:
Change and remove
See the physics
Test rooms and the Studio can show the physics view over your drawings: every disc, wall, crossing and joint as disko moves them. Use it to check that what players see matches what collides.
See the world reference for every shape and
option.