Skip to content

Animations#

There are cases where you might want to add animations to your buildings. Night lights are also considered as animations.

Generally, animations consist of 2 parts:

  • Animation draft, that defines an animation that we can reuse.
  • Animation array, that is defined on a building that includes defined animation drafts.

First of all, let's define our animation draft:

[
  {
    "id": "myanimation",
    "type": "animation",
    "frames": [
      // Moment number 1
      {
        "bmp": "myanim.png",
        "move x": 5, // Our animation will be in x=5
        "move y": 16 // and y=16
      },
      // Moment number 2
      {
        "bmp": "myanim.png",
        "move x": 10, // Our animation will be in x=10
        "move y": 16  // and y=16
      }     
    ]
  }
]

Now to use it on a building, we would add it to the animation attribute array like so:

[
  {
    "id": "buildingwithanimation",
    "type": "decoration",
    "width": 1,
    "height": 1,
    "frames": [{"bmp": "basepart.png"}],
    "animation": [
      // We reference the previously defined animation draft via ID
      {"id": "myanimation"}
    ]
  }
]

You can find extra attributes for animation drafts here and animation objects here.

The Domkisas Embassy plugin makes heavy use of animations to save texture space:

You may download the plugin animation code here:
embassy.zip

This page has been adapted from a topic on the official TheoTown forum.