Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

sprites/{id}.obj.json — file map

Reusable object definitions. One file per id under sprites/. Instances use the obj command. See Objects.

The whole file

Keys with { … } open below. Linked names jump to that section. Grey notes say what each key does. Under each section, Keys lists type, If omitted, allowed values, and a short note.

{
  "id": "lamp_widget",         // definition id
  "layer": "overlay",          // default draw plane
  "transition_in": "fade",     // default show
  "transition_out": "fade",    // default hide
  "transition_duration": 0.3,  // default fade length
  "modulate": "#ffffff",       // root tint
  "scale": 1.0,                // root scale
  "rotation_degrees": 0,       // root rotation
  "parts": [ { … } ]           // pieces of the object (required)
}

Root keys

Top-level keys that are not objects.

id string
If omitted required
Must match the file stem.
layer enum
If omitted overlay
Values bg_front · fg · overlay
Where instances draw unless the command overrides.
transition_in enum
If omitted instant
Values instant · fade · slide_up · slide_down · slide_left · slide_right
Default enter transition for instances.
transition_out enum
If omitted instant
Values instant · fade · slide_up · slide_down · slide_left · slide_right
Default leave transition.
transition_duration number
If omitted 0
Values seconds
Seconds for default transitions.
modulate color
If omitted no tint
Colour multiply for the whole object.
scale number
If omitted 1
Number or [sx, sy].
rotation_degrees number
If omitted 0
Degrees.

Learn more: id

parts

Pieces of the object (required).

{
  "parts": [ {                                // pieces of the object (required)
    "id": "ptr",                              // part id
    "kind": "polygon",                        // shape
    "x": 0,                                   // local x
    "y": 0,                                   // local y
    "width": 40,                              // width
    "height": 20,                             // height
    "order": 0,                               // draw order
    "points": [[0, 0], [10, 0], [5, 8]],      // polygon points
    "color": "#343a52e0",                     // fill colour
    "opacity": 1.0,                           // alpha
    "visible": true,                          // shown
    "path": "sprites/face.png",               // image path
    "text": "OK",                             // caption
    "bind": {"y": {"flag": "score", "map": {"5": 23}}},  // live flag links
    "bbcode_enabled": false,                  // rich text
    "font_size": 16,                          // text size
    "align_h": "left",                        // text align
    "autowrap": false                         // wrap text
  } ]
}

Keys

id string
If omitted required
Used by obj update patches.
kind enum
If omitted required
Values image · rect · polygon · text
What this part draws.
x number
If omitted 0
Offset inside the object.
y number
If omitted 0
Offset inside the object.
width number
If omitted from art
For rect / text / sized images.
height number
If omitted from art
For rect / text / sized images.
order number
If omitted 0
Higher draws above.
points array
If omitted polygon only
[[x,y], …] for kind: polygon.
color color
If omitted white / theme
Rect / polygon / text colour.
opacity number
If omitted 1
0–1.
visible bool
If omitted true
Hide a part without removing it.
path path
If omitted image kinds
For kind: image.
text string
If omitted text kind
For kind: text.
bind object
If omitted none
Flag → property — [Live flags](../../directing/live-flags.md).
bbcode_enabled bool
If omitted false
For kind: text.
font_size number
If omitted theme default
For kind: text.
align_h enum
If omitted left
Values left · center · right
For kind: text.
autowrap bool
If omitted false
For kind: text.

Learn more: parts