SpriteInfo.new()

   
Type function
Library wattageTileEngine.SpriteInfo.*
Return value SpriteInfo
Keywords  
See also  

Overview

NOTE: THIS FUNCTION IS DEPRECATED. IN ITS PLACE SIMPLY USE A TABLE WITH THE PROPERTIES: imageRect, width, and height. FOR EXAMPLE:

local displayObject = display.newImageRect("img/myImage.png", 100, 100)
local spriteInfo = {
    imageRect = displayObject,
    width = 100,
    height = 100
}

REPEATEDLY CALLING SpriteInfo.new() HAS A SLIGHT PERFORMANCE IMPACT.

This function creates a new instance of type SpriteInfo.

Syntax

SpriteInfo.new( params )
params (required)

Table. Contains all required inputs. See Required Properties below.

Required Properties

The params table contains the following properties:

imageRect (required)

DisplayObject. The DisplayObject for the sprite.

width (required)

Number. The width of the sprite.

height (required)

Number. The height of the sprite.

Examples

local TileEngine = require "plugin.wattageTileEngine"
local SpriteInfo = TileEngine.SpriteInfo

local square = Display.newRect(10, 10, 10, 10)
local spriteInfoInstance = SpriteInfo.new({
    imageRect = square,
    width = 10,
    height = 10
})