GetTileDelay

From Spheriki

Jump to: navigation, search

Gets the animation delay of the tile before the next designated frame.


Contents

Usage

number GetTileDelay(tile_index);
  • tile_index Number, non-negative. The index of the tile on the current map to get the animation delay of.
  • number is returned, representing the number of frames between this tile and the next in the tile animation.


Examples

var frames_delay = GetTileDelay(7);

Grabs the frame delay of the eighth tile (index 7) and stores it in frames_delay.


Notes

  • This function only works when a map is loaded in the map engine, so make sure it's running first (i.e. use MapEngine()).
  • The delay is the number of frames before the map engine switches this tile to the next, e.g. if the delay of tile 7 is 60, it leads to tile 9 and the map engine is running at 60 FPS, then all instances of tile 7 on the map will switch to tile 9 after exactly one second. If it was at 30 FPS, tile 7 is changed to tile 9 after two seconds, and so on.
  • If the delay is zero, the tile is not animated, or it is the end of an animation chain.
  • To modify the delay between one tile and the next in the animation chain at runtime, use SetTileDelay(). If the delay isn't going to change, it may be easier and more efficient to simply set this delay in the Sphere IDE's map editor (right-click in the tile palette while the map is open.)


See also

Personal tools