Table of Contents

Sprite:getBounds

Available since version: Gideros 2011.6

Description:

Returns a rectangle (as x, y, width and height) that encloses the sprite as it appears in another sprite's coordinate system.

Syntax:

(number), (number), (number), (number) = Sprite:getBounds(targetSprite)

Parameters:

  • targetSprite: (Sprite) the sprite that defines the other coordinate system to transform

Return value:

  • number: x coordinate
  • number: y coordinate
  • number: width of Sprite
  • number: height of Sprite

Examples:

local x, y, width, height = sprite:getBounds(sprite) -- returns local (untransformed) bounds
local x, y, width, height = sprite:getBounds(stage) -- returns bounds as transformed to stage's coordinate system