Difference between revisions of "Sprite:getBounds"
From GiderosMobile
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
'''<translate>Available since</translate>:''' Gideros 2011.6<br/> | '''<translate>Available since</translate>:''' Gideros 2011.6<br/> | ||
+ | '''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/> | ||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
<translate><br /> | <translate><br /> |
Revision as of 09:29, 24 August 2018
Available since: Gideros 2011.6
Class: Sprite
Description
Returns a rectangle (as x, y, width and height) that encloses the sprite as it appears in another sprite's coordinate system.
(number), (number), (number), (number) = Sprite:getBounds(targetSprite)
Parameters
targetSprite: (Sprite) the sprite that defines the other coordinate system to transform
Return values
Returns (number) x coordinate
Returns (number) y coordinate
Returns (number) width of Sprite
Returns (number) height of Sprite
Examples
Example
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