Sprite:getBounds: Difference between revisions
From GiderosMobile
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
=== Description === | === Description === | ||
<br /> | <translate><br /> | ||
Returns a rectangle (as x, y, width and height) that encloses the sprite as it appears in another sprite's coordinate system.<br /> | Returns a rectangle (as x, y, width and height) that encloses the sprite as it appears in another sprite's coordinate system.<br /> | ||
<br /> | <br /></translate> | ||
<source lang="lua"> | <source lang="lua"> | ||
(number), (number), (number), (number) = Sprite:getBounds(targetSprite) | (number), (number), (number), (number) = Sprite:getBounds(targetSprite) | ||
</source> | </source> | ||
=== Parameters === | === Parameters === | ||
'''targetSprite''': (Sprite) the sprite that defines the other coordinate system to transform <br/> | '''targetSprite''': (Sprite) <translate>the sprite that defines the other coordinate system to transform</translate> <br/> | ||
=== Return values === | === Return values === | ||
'''Returns''' (number) x coordinate<br/> | '''Returns''' (number) <translate>x coordinate</translate><br/> | ||
'''Returns''' (number) y coordinate<br/> | '''Returns''' (number) <translate>y coordinate</translate><br/> | ||
'''Returns''' (number) width of Sprite<br/> | '''Returns''' (number) <translate>width of Sprite</translate><br/> | ||
'''Returns''' (number) height of Sprite<br/> | '''Returns''' (number) <translate>height of Sprite</translate><br/> | ||
=== Examples === | === Examples === | ||
'''Example'''<br/> | '''Example'''<br/> | ||
<source lang="lua">local x, y, width, height = sprite:getBounds(sprite) -- returns local (untransformed) bounds | <source lang="lua">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 | local x, y, width, height = sprite:getBounds(stage) -- returns bounds as transformed to stage's coordinate system</source> | ||
Revision as of 12:34, 23 August 2018
Available since: 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.
(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