Skip to content

Bar

A bar that fills up to show Value out of Max: health, a boss’s health, charge, a timer. Name an entity in Track and it shows that entity’s Health with no code, or any of its outputs with Output (a board’s score towards its target, a turn’s time left). When it goes down, the part just lost lingers in the Trail color for a moment before draining away. Its parts can be pictures too: a FillImage revealed as it fills, over a BackgroundImage.

Draws itself (its entity draws at Order 100 unless it has a Sprite, whose order counts).

Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.

  • value: a number = 1. How full it is, out of Max. (Field: a number.)
  • max: a number = 1. The value at which it’s full. (Field: a number.)
  • track: text = null. The name of an entity whose Health the bar shows, e.g. “Player” or “Boss”: its Current out of its Max, every frame (or its Output). Once that entity is gone the bar shows empty. (Names an entity.) (Field: an entity’s name.)
  • output: text = null. Show an output instead of health: what it gives now (see component_describe’s Outputs), out of what it says it’s out of, or Max if it doesn’t, e.g. a board’s “Score” (out of its Target Score), a turn order’s “Time Left”, a faction’s “Amount:Gold”. Without a Track, it’s this entity’s, or the nearest one it’s inside. (Names an output of the entity track names, or without one this entity or the nearest it’s inside with it: one component_describe lists under Outputs, a number or true or false, e.g. “Score”, “MatchBoard.Score” for one component’s, or “Amount:Gold” for one read by a name.) (Field: an output’s name.)
  • size: [x, y] = [3,0.35]. World units before the transform’s scale, centered on the entity. (A rectangle’s size, around the entity, in its own units before its scale: with Resize handles the Scene view puts handles on its edges and corners to drag.) (Field: a vector.)
  • fill: a color, “#RRGGBB” or “#RRGGBBAA” = “#57AB5AFF”. The color of the full part, or what tints its FillImage (white shows the picture as it is). (Field: a color.)
  • background: a color, “#RRGGBB” or “#RRGGBBAA” = “#00000080”. The empty part of the bar, or what tints its BackgroundImage (white shows the picture as it is). (Field: a color.)
  • trail: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFFFFFBF”. The part just lost, shown for a moment before it drains away. Transparent for none. (Field: a color.)
  • direction: one of Right, Left, Up, Down = “Right”. Which way it fills. (Field: one of its values.)
  • order: a whole number = 100. Higher draws on top, like Sprite.Order. (Field: a number.)
  • fillImage: text = null. A picture for the full part instead of a plain color, e.g. “Sprites/gauge.png”: laid over the whole bar and shown only as far as it’s full in its Direction, cut off there rather than squeezed, so it stays crisp. The trail shows the same picture, tinted by Trail. (A picture in Assets, e.g. “Sprites/back.png”.) (Field: an image.)
  • backgroundImage: text = null. A picture for the bar behind the fill, shown whole, instead of a plain color. (A picture in Assets, e.g. “Sprites/back.png”.) (Field: an image.)
  • backgroundSlice: a number = 0. For a background that stretches (nine-slice), like Sprite.Slice: how much of the BackgroundImage, from 0 to 0.5 of its width and height, is border at each edge. Its corners then keep their shape however long the bar is. 0 stretches the whole picture. (Only used when backgroundImage is set.) (Field: a number.)
  • backgroundSliceSize: a number = 0.1. With BackgroundSlice: how big the border is drawn, in world units (never more than half the bar). (Only used when backgroundSlice is set.) (Field: a number.)

Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.

  • fraction: a number. How full the bar is, from 0 to 1.
  • trailFraction: a number. How far the Trail reaches, from 0 to 1: at least Fraction.

Scripts use it as Bar: its methods, events and values that aren’t saved with the scene.