Difference between revisions of "Sprite:get"

From GiderosMobile
Line 28: Line 28:
 
(number) = Sprite:get(param)
 
(number) = Sprite:get(param)
 
</source>
 
</source>
'''param''': (string) The name of the parameter ''''''<br/>
+
=== Parameters ===
 +
'''param''': (string) The name of the parameter <br/>
 +
=== Return values ===
 
'''Returns''' (number) The value of the parameter<br/>
 
'''Returns''' (number) The value of the parameter<br/>
 +
=== Examples ===
 +
'''Example'''<br/>
 +
<source lang="lua">-- the following two lines do the same thing<br />
 +
x = sprite:getX()<br />
 +
x = sprite:get(&quot;x&quot;)<br />
 +
<br />
 +
-- the following two lines do the same thing<br />
 +
y = sprite:getY()<br />
 +
y = sprite:get(&quot;y&quot;)<br />
 +
<br />
 +
-- the following two lines do the same thing<br />
 +
rotation = sprite:getRotation()<br />
 +
rotation = sprite:get(&quot;rotation&quot;)<br />
 +
<br />
 +
-- the following two lines do the same thing<br />
 +
scaleX = sprite:getScaleX()<br />
 +
scaleX = sprite:get(&quot;scaleX&quot;)<br />
 +
<br />
 +
-- the following two lines do the same thing<br />
 +
scaleY = sprite:getScaleY()<br />
 +
scaleY = sprite:get(&quot;scaleY&quot;)<br /></source>

Revision as of 10:44, 23 August 2018

Available since: Gideros 2011.6

Description


Returns the specified property of this sprite instance by its name. These names are supported:


  • `"x"`

  • `"y"`

  • `"z"`

  • `"rotation"`

  • `"rotationX"`

  • `"rotationY"`

  • `"scaleX"`

  • `"scaleY"`

  • `"scaleZ"`

  • `"alpha"`

  • `"redMultiplier"`

  • `"greenMultiplier"`

  • `"blueMultiplier"`

  • `"alphaMultiplier"`

  • `"anchorX"`

  • `"anchorY"`

  • `"anchorZ"`



(number) = Sprite:get(param)

Parameters

param: (string) The name of the parameter

Return values

Returns (number) The value of the parameter

Examples

Example

-- the following two lines do the same thing<br />
x = sprite:getX()<br />
x = sprite:get(&quot;x&quot;)<br />
	<br />
-- the following two lines do the same thing<br />
y = sprite:getY()<br />
y = sprite:get(&quot;y&quot;)<br />
<br />
-- the following two lines do the same thing<br />
rotation = sprite:getRotation()<br />
rotation = sprite:get(&quot;rotation&quot;)<br />
<br />
-- the following two lines do the same thing<br />
scaleX = sprite:getScaleX()<br />
scaleX = sprite:get(&quot;scaleX&quot;)<br />
<br />
-- the following two lines do the same thing<br />
scaleY = sprite:getScaleY()<br />
scaleY = sprite:get(&quot;scaleY&quot;)<br />