Difference between revisions of "Sprite:get"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Returns the specified property of this sprite instance by its name.
 
Returns the specified property of this sprite instance by its name.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(number) = Sprite:get(param)
 
(number) = Sprite:get(param)
</source>
+
</syntaxhighlight>
  
 
Supported names are:
 
Supported names are:
Line 35: Line 35:
  
 
=== Examples ===
 
=== Examples ===
<source lang="lua">
+
<syntaxhighlight 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 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")