Difference between revisions of "Sprite:get"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(8 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 ===
<translate><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>[[Special:MyLanguage/"x"|"x"]]</li><br />
 
<li>[[Special:MyLanguage/"y"|"y"]]</li><br />
 
<li>[[Special:MyLanguage/"z"|"z"]]</li><br />
 
<li>[[Special:MyLanguage/"rotation"|"rotation"]]</li><br />
 
<li>[[Special:MyLanguage/"rotationX"|"rotationX"]]</li><br />
 
<li>[[Special:MyLanguage/"rotationY"|"rotationY"]]</li><br />
 
<li>[[Special:MyLanguage/"scaleX"|"scaleX"]]</li><br />
 
<li>[[Special:MyLanguage/"scaleY"|"scaleY"]]</li><br />
 
<li>[[Special:MyLanguage/"scaleZ"|"scaleZ"]]</li><br />
 
<li>[[Special:MyLanguage/"alpha"|"alpha"]]</li><br />
 
<li>[[Special:MyLanguage/"redMultiplier"|"redMultiplier"]]</li><br />
 
<li>[[Special:MyLanguage/"greenMultiplier"|"greenMultiplier"]]</li><br />
 
<li>[[Special:MyLanguage/"blueMultiplier"|"blueMultiplier"]]</li><br />
 
<li>[[Special:MyLanguage/"alphaMultiplier"|"alphaMultiplier"]]</li><br />
 
<li>[[Special:MyLanguage/"anchorX"|"anchorX"]]</li><br />
 
<li>[[Special:MyLanguage/"anchorY"|"anchorY"]]</li><br />
 
<li>[[Special:MyLanguage/"anchorZ"|"anchorZ"]]</li><br />
 
</ul><br />
 
<br /></translate>
 
<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) <translate>The name of the parameter</translate> <br/>
+
'''param''': (string) the name of the parameter<br/>
 +
 
 
=== Return values ===
 
=== Return values ===
'''Returns''' (number) <translate>The value of the parameter</translate><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
+
-- 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")
 +
</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")