> For the complete documentation index, see [llms.txt](https://doc.lucky-cycle.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.lucky-cycle.com/games/index/train.md).

# Train

{% hint style="warning" %}
Demo: <https://campaigns.lucky-cycle.com/utils/games?game=train>
{% endhint %}

1. [#configuration](#configuration "mention")
2. [#options](#options "mention")
3. [#assets](#assets "mention")

### Configuration

<details>

<summary>JSON</summary>

```json
{
  "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": {}
  }
}
```

</details>

### Options

<table><thead><tr><th>Key</th><th>Type</th><th>Explanation</th><th>Default</th></tr></thead><tbody><tr><td><pre><code>aspect_ratio
</code></pre></td><td>String</td><td>Ratio of the game (default is square).</td><td>"1:1"</td></tr><tr><td><pre><code>cars
</code></pre></td><td>Int</td><td>Number of cars in the train (head not included).</td><td>3</td></tr><tr><td><pre><code>trail
</code></pre></td><td>Int</td><td>Number of empty "spaces" before the train loops back.</td><td>1</td></tr><tr><td><pre><code>train_size
</code></pre></td><td>Int</td><td>Size of a car (square, x = y).</td><td>400</td></tr><tr><td><pre><code>reveal_size
</code></pre></td><td>Int</td><td>Final size of the reveal animation (square, x = y). </td><td>800</td></tr><tr><td><pre><code>train_y
</code></pre></td><td>Int</td><td>Vertical positioning of the train (relative to the container).</td><td>325</td></tr><tr><td><pre><code>box_y
</code></pre></td><td>Int</td><td>Vertical positioning of the box (relative to the train car).</td><td>-100</td></tr><tr><td><pre><code>box_padding
</code></pre></td><td>Int</td><td>Space around the box (to make it smaller than the car).</td><td>50</td></tr><tr><td><pre><code>box_rotation
</code></pre></td><td>Int</td><td>Rotation of the box (reversed between cars).</td><td>10</td></tr><tr><td><pre><code>halo
</code></pre></td><td>String</td><td>Background color for the reveal (circle shaped).</td><td>"rgba(255, 255, 255, 0.25)"</td></tr><tr><td><pre><code>animation_duration
</code></pre></td><td>Int</td><td>Duration (in milliseconds) of the reveal animation.</td><td>500</td></tr><tr><td><pre><code>reveal_fps
</code></pre></td><td>Int</td><td>Frames per second for the reveal animation.</td><td>120</td></tr><tr><td><pre><code>speed
</code></pre></td><td>Int</td><td>Speed of the train (horizontal).</td><td>1.5</td></tr><tr><td><pre><code>use_reward_image
</code></pre></td><td>Boolean</td><td>Decides if the animation should use the default <em>win</em> visual for the animation, or a specific one per reward (<em>lose</em> can't be changed).</td><td>false</td></tr></tbody></table>

### Assets

<table><thead><tr><th>Key</th><th>Size</th><th>Explanation</th><th>Default</th></tr></thead><tbody><tr><td><pre><code>background
</code></pre></td><td>1000 x 1000</td><td>Background of the game.</td><td><a href="https://statics.lucky-cycle.com/files/_games/train/background.png">/background.png</a></td></tr><tr><td><pre><code>head
</code></pre></td><td>500 x 500</td><td>Head of the train.</td><td><a href="https://statics.lucky-cycle.com/files/_games/train/head.png">/head.png</a></td></tr><tr><td><pre><code>cars
</code></pre></td><td>500 x 500</td><td>Car of the train.</td><td><a href="https://statics.lucky-cycle.com/files/_games/train/car.png">/car.png</a></td></tr><tr><td><pre><code>box
</code></pre></td><td>400 x 400</td><td>Box (closed).</td><td><a href="https://statics.lucky-cycle.com/files/_games/train/box.png">/box.png</a></td></tr><tr><td><pre><code>halo
</code></pre></td><td>500 x 500</td><td>Halo (can replace, or used in combination with the <em>halo</em> color option)</td><td>/</td></tr><tr><td><pre><code>win
</code></pre></td><td><mark style="color:yellow;">(500*sprite)</mark> x 500</td><td>Win sprite (each one must be square).</td><td><a href="https://statics.lucky-cycle.com/files/_games/train/win.png">/win.png</a></td></tr><tr><td><pre><code>lose
</code></pre></td><td><mark style="color:yellow;">(500*sprite)</mark> x 500</td><td>Lose sprite (each one must be square).</td><td><a href="https://statics.lucky-cycle.com/files/_games/train/lose.png">/lose.png</a></td></tr></tbody></table>
