Difference between revisions of "Sprite:get"

From GiderosMobile
(formatting)
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Class:''' [[Sprite]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
 
  
=== <translate>Description</translate> ===
+
=== Description ===
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.
 +
<syntaxhighlight lang="lua">
 +
(number) = Sprite:get(param)
 +
</syntaxhighlight>
 +
 
 +
Supported names are:
 
*''"x"''
 
*''"x"''
 
*''"y"''
 
*''"y"''
Line 23: Line 27:
 
*''"anchorY"''
 
*''"anchorY"''
 
*''"anchorZ"''
 
*''"anchorZ"''
<source lang="lua">
 
(number) = Sprite:get(param)
 
</source>
 
  
=== <translate>Parameters</translate> ===
+
=== Parameters ===
'''param''': (string) <translate>the name of the parameter</translate> <br/>
+
'''param''': (string) the name of the parameter<br/>
  
=== <translate>Return values</translate> ===
+
=== Return values ===
'''<translate>Returns</translate>''' (number) <translate>the value of the parameter</translate><br/>
+
'''Returns''' (number) the value of the parameter<br/>
  
=== <translate>Examples</translate> ===
+
=== Examples ===
'''Example'''
+
<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()
Line 55: Line 55:
 
scaleY = sprite:getScaleY()
 
scaleY = sprite:getScaleY()
 
scaleY = sprite:get("scaleY")
 
scaleY = sprite:get("scaleY")
</source>
+
</syntaxhighlight>
  
 
{{Sprite}}
 
{{Sprite}}

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