Difference between revisions of "Sprite:get"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(11 intermediate revisions by 2 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 />
+
Returns the specified property of this sprite instance by its name.
Returns the specified property of this sprite instance by its name. These names are supported:<br />
+
<syntaxhighlight lang="lua">
<br />
 
<ul><br />
 
<li>`"x"`</li><br />
 
<li>`"y"`</li><br />
 
<li>`"z"`</li><br />
 
<li>`"rotation"`</li><br />
 
<li>`"rotationX"`</li><br />
 
<li>`"rotationY"`</li><br />
 
<li>`"scaleX"`</li><br />
 
<li>`"scaleY"`</li><br />
 
<li>`"scaleZ"`</li><br />
 
<li>`"alpha"`</li><br />
 
<li>`"redMultiplier"`</li><br />
 
<li>`"greenMultiplier"`</li><br />
 
<li>`"blueMultiplier"`</li><br />
 
<li>`"alphaMultiplier"`</li><br />
 
<li>`"anchorX"`</li><br />
 
<li>`"anchorY"`</li><br />
 
<li>`"anchorZ"`</li><br />
 
</ul><br />
 
<br />
 
<source lang="lua">
 
 
(number) = Sprite:get(param)
 
(number) = Sprite:get(param)
</source>
+
</syntaxhighlight>
 +
 
 +
Supported names are:
 +
*''"x"''
 +
*''"y"''
 +
*''"z"''
 +
*''"rotation"''
 +
*''"rotationX"''
 +
*''"rotationY"''
 +
*''"scaleX"''
 +
*''"scaleY"''
 +
*''"scaleZ"''
 +
*''"alpha"''
 +
*''"redMultiplier"''
 +
*''"greenMultiplier"''
 +
*''"blueMultiplier"''
 +
*''"alphaMultiplier"''
 +
*''"anchorX"''
 +
*''"anchorY"''
 +
*''"anchorZ"''
 +
 
 
=== Parameters ===
 
=== Parameters ===
'''param''': (string) The name of the parameter <br/>
+
'''param''': (string) the name of the parameter<br/>
 +
 
 
=== Return values ===
 
=== Return values ===
'''Returns''' (number) The value of the parameter<br/>
+
'''Returns''' (number) the value of the parameter<br/>
 +
 
 
=== Examples ===
 
=== Examples ===
'''Example'''<br/>
+
<syntaxhighlight lang="lua">
<source lang="lua">-- the following two lines do the same thing<br />
+
-- the following two lines do the same thing
x = sprite:getX()<br />
+
x = sprite:getX()
x = sprite:get(&quot;x&quot;)<br />
+
x = sprite:get("x")
<br />
+
-- the following two lines do the same thing<br />
+
-- the following two lines do the same thing
y = sprite:getY()<br />
+
y = sprite:getY()
y = sprite:get(&quot;y&quot;)<br />
+
y = sprite:get("y")
<br />
+
 
-- the following two lines do the same thing<br />
+
-- the following two lines do the same thing
rotation = sprite:getRotation()<br />
+
rotation = sprite:getRotation()
rotation = sprite:get(&quot;rotation&quot;)<br />
+
rotation = sprite:get("rotation")
<br />
+
 
-- the following two lines do the same thing<br />
+
-- the following two lines do the same thing
scaleX = sprite:getScaleX()<br />
+
scaleX = sprite:getScaleX()
scaleX = sprite:get(&quot;scaleX&quot;)<br />
+
scaleX = sprite:get("scaleX")
<br />
+
 
-- the following two lines do the same thing<br />
+
-- the following two lines do the same thing
scaleY = sprite:getScaleY()<br />
+
scaleY = sprite:getScaleY()
scaleY = sprite:get(&quot;scaleY&quot;)<br /></source>
+
scaleY = sprite:get("scaleY")
 +
</syntaxhighlight>
 +
 
 +
{{Sprite}}

Latest revision as of 15:33, 13 July 2023

Available since: Gideros 2011.6
Class: Sprite

Description

Returns the specified property of this sprite instance by its name.

(number) = Sprite:get(param)

Supported names are:

  • "x"
  • "y"
  • "z"
  • "rotation"
  • "rotationX"
  • "rotationY"
  • "scaleX"
  • "scaleY"
  • "scaleZ"
  • "alpha"
  • "redMultiplier"
  • "greenMultiplier"
  • "blueMultiplier"
  • "alphaMultiplier"
  • "anchorX"
  • "anchorY"
  • "anchorZ"

Parameters

param: (string) the name of the parameter

Return values

Returns (number) the value of the parameter

Examples

-- the following two lines do the same thing
x = sprite:getX()
x = sprite:get("x")
	
-- the following two lines do the same thing
y = sprite:getY()
y = sprite:get("y")

-- the following two lines do the same thing
rotation = sprite:getRotation()
rotation = sprite:get("rotation")

-- the following two lines do the same thing
scaleX = sprite:getScaleX()
scaleX = sprite:get("scaleX")

-- the following two lines do the same thing
scaleY = sprite:getScaleY()
scaleY = sprite:get("scaleY")