The Tile class
The tile class contains primitives to display the contents of a SpriteSheet.
See also: Widget
Example:
 
  dofile("SDK/Graphics2D.lua")
  -- Load a spritesheet
  spritesheet = SpriteSheet("maps/anim.png",90,90,2)
  -- Create a looping animation
  -- from 0 to 3 with 70ms per frame
  animation = SpriteAnimation(0,3,70,true)
  -- Create a tile without caption
  tile = Tile(20,20,90,90,spritesheet, 0, 0, "")
  -- Attach animation to tile
  tile:attachAnimation(animation)
  -- Add tile to the main canvas
  mainCanvas:addWidget(tile)
  function onSceneUpdate()
    -- Update tile animation
    tile:update()
  end
See also: SpriteSheet, SpriteAnimation
Tile(x,y,w,h,spritesheet,tx,ty,text)
Constructs a Tile object. The text parameter is optional.
function Tile:attachAnimation(animation)
Attach an SpriteAnimation to an Tile object
and the animation will automatically apply when calling
'Tile:update' every frame.
Parameter
animation
The SpriteAnimation object to attach.
function Tile:update()
Updates the attached animation if there is one.