Sprite:get: Difference between revisions

From GiderosMobile
Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === <br /> Returns the specified property of this sprite instance by its name. These names are supported:<..."
 
m Text replacement - "</source>" to "</syntaxhighlight>"
 
(13 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 />
(number) = Sprite:get(param)
<ul><br />
</syntaxhighlight>
<li>`"x"`</li><br />
 
<li>`"y"`</li><br />
Supported names are:
<li>`"z"`</li><br />
*''"x"''
<li>`"rotation"`</li><br />
*''"y"''
<li>`"rotationX"`</li><br />
*''"z"''
<li>`"rotationY"`</li><br />
*''"rotation"''
<li>`"scaleX"`</li><br />
*''"rotationX"''
<li>`"scaleY"`</li><br />
*''"rotationY"''
<li>`"scaleZ"`</li><br />
*''"scaleX"''
<li>`"alpha"`</li><br />
*''"scaleY"''
<li>`"redMultiplier"`</li><br />
*''"scaleZ"''
<li>`"greenMultiplier"`</li><br />
*''"alpha"''
<li>`"blueMultiplier"`</li><br />
*''"redMultiplier"''
<li>`"alphaMultiplier"`</li><br />
*''"greenMultiplier"''
<li>`"anchorX"`</li><br />
*''"blueMultiplier"''
<li>`"anchorY"`</li><br />
*''"alphaMultiplier"''
<li>`"anchorZ"`</li><br />
*''"anchorX"''
</ul><br />
*''"anchorY"''
<br />
*''"anchorZ"''
<source lang="lua">
 
(number), = Sprite:get(param,)
=== Parameters ===
</source>
'''param''': (string) the name of the parameter<br/>
'''param:''' (string) The name of the parameter ''''''<br/>
 
'''Returns''' (number) The value of the parameter<br/>
=== Return values ===
'''Returns''' (number) the value of the parameter<br/>
 
=== Examples ===
<syntaxhighlight lang="lua">
-- 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")
</syntaxhighlight>
 
{{Sprite}}

Latest revision as of 13: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")