Difference between revisions of "Sprite:get"

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

Revision as of 04:46, 7 July 2020


Available since: Gideros 2011.6
Class: Sprite

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
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")