Difference between revisions of "Sprite:globalToLocal"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 +
'''Class:''' [[Sprite]]<br/>
 +
 
=== Description ===
 
=== Description ===
<br />
+
Converts the x,y coordinates from the global to the sprite (local) coordinates.
Converts the x,y coordinates from the global to the sprite's (local) coordinates.<br />
+
<syntaxhighlight lang="lua">
<br />
 
<br />
 
<source lang="lua">
 
 
(number), (number) = Sprite:globalToLocal(x,y)
 
(number), (number) = Sprite:globalToLocal(x,y)
</source>
+
</syntaxhighlight>
'''x''': (number) x coordinate of the global coordinate. ''''''<br/>
+
 
'''y''': (number) y coordinate of the global coordinate. ''''''<br/>
+
=== Parameters ===
'''Returns''' (number) 1. x coordinate relative to the display object.<br/>
+
'''x''': (number) x coordinate of the global coordinate<br/>
'''Returns''' (number) 2. y coordinate relative to the display object.<br/>
+
'''y''': (number) y coordinate of the global coordinate<br/>
 +
 
 +
=== Return values ===
 +
'''Returns''' (number) x coordinate relative to the display object<br/>
 +
'''Returns''' (number) y coordinate relative to the display object<br/>
 +
 
 +
{{Sprite}}

Latest revision as of 15:33, 13 July 2023

Available since: Gideros 2011.6
Class: Sprite

Description

Converts the x,y coordinates from the global to the sprite (local) coordinates.

(number), (number) = Sprite:globalToLocal(x,y)

Parameters

x: (number) x coordinate of the global coordinate
y: (number) y coordinate of the global coordinate

Return values

Returns (number) x coordinate relative to the display object
Returns (number) y coordinate relative to the display object