Animation support

Hi,

It was mentioned previously that the websocket API now supports animation. Is there any example code or even just a code snippet illustrating how it’s used?

There are two different types of animation currently offered:

  1. A ‘static’ repeating animation (though non-looping is offered) which renders in place of an objects normal image. This is caused by a unique property on the object, which must be set by either a custom script or by editing the JSON.

Example Object:

{"offsetX":0,
  "x":20,
  "highlighted":"https://cdn.gather.town/storage.googleapis.com/gather-town.appspot.com/uploads/oxrhEtb3sV7VutbQ/TnLd1QwcHJrqEOJ2rO2k4w",
  "spritesheet":{
    "animations":{
      "default":{
        "useSequenceAsRange":true,
        "frameRate":6,
        "loop":true,
        "sequence":[0,5]
        }
    },
    "framing":{
      "frameWidth":64,
      "frameHeight":96
      },
    "currentAnim":"default",
    "spritesheetUrl":"https://cdn.gather.town/storage.googleapis.com/gather-town.appspot.com/uploads/oxrhEtb3sV7VutbQ/Nh7Rng3SvwZLHXxmvL1yms"
  },
  "color":"default",
  "width":2,
  "offsetY":0,
  "objectPlacerId":"4cQU2MUyzVRqGryqYFecOSotH5D3",
  "normal":"https://cdn.gather.town/storage.googleapis.com/gather-town.appspot.com/uploads/oxrhEtb3sV7VutbQ/8QPrJNQNTK7GVbgFJbcf8y",
  "_tags":["Custom"],
  "y":30,
  "height":3,
  "previewMessage":"FIRE!!",
  "_name":"animated fireplace",
  "templateId":"bFnSvEBFhwqWPvLulQWa2",
  "properties":{},
  "type":5,
  "id":"ObjectID",
  "orientation":0}
  1. A one-time object move animation, with various behaviors. This is caused by a moveMapObject command. The Comments in the Gather-game-client documents are good to address this, but effectively this animates moving an object from point A to point B.
2 Likes

Thank you @Bill_Uncork-It