githubEdit

Train

Configuration

chevron-rightJSONhashtag
{
  "options": {
    "aspect_ratio": "1:1",
    "cars": 3,
    "trail": 1,
    "train_size": 400,
    "reveal_size": 800,
    "train_y": 325,
    "box_y": -100,
    "box_padding": 50,
    "box_rotation": 10,
    "halo": "rgba(255, 255, 255, 0.25)",
    "animation_duration": 500,
    "reveal_fps": 120,
    "speed": 1.5,
    "use_reward_image": false
  },
  "texts": {
    "en": {},
    "fr": {},
    "nl": {}
  },
  "images": {
    "background": GAME_URL + "/background.png",
    "head": GAME_URL + "/head.png",
    "cars": [ GAME_URL + "/car.png" ],
    "box": GAME_URL + "/box.png",
    "halo": "",
    "win": GAME_URL + "/win.png",
    "lose": GAME_URL + "/lose.png",
    "rewards": {}
  }
}

Options

Key
Type
Explanation
Default

String

Ratio of the game (default is square).

"1:1"

Int

Number of cars in the train (head not included).

3

Int

Number of empty "spaces" before the train loops back.

1

Int

Size of a car (square, x = y).

400

Int

Final size of the reveal animation (square, x = y).

800

Int

Vertical positioning of the train (relative to the container).

325

Int

Vertical positioning of the box (relative to the train car).

-100

Int

Space around the box (to make it smaller than the car).

50

Int

Rotation of the box (reversed between cars).

10

String

Background color for the reveal (circle shaped).

"rgba(255, 255, 255, 0.25)"

Int

Duration (in milliseconds) of the reveal animation.

500

Int

Frames per second for the reveal animation.

120

Int

Speed of the train (horizontal).

1.5

Boolean

Decides if the animation should use the default win visual for the animation, or a specific one per reward (lose can't be changed).

false

Assets

Key
Size
Explanation
Default

1000 x 1000

Background of the game.

500 x 500

Head of the train.

500 x 500

Car of the train.

400 x 400

Box (closed).

500 x 500

Halo (can replace, or used in combination with the halo color option)

/

(500*sprite) x 500

Win sprite (each one must be square).

(500*sprite) x 500

Lose sprite (each one must be square).

Last updated