Sprite:set: Difference between revisions

From GiderosMobile
Rrraptor (talk | contribs)
Rrraptor (talk | contribs)
Line 38: Line 38:
<source lang="lua">-- the following two lines do the same thing
<source lang="lua">-- the following two lines do the same thing
sprite:setX(10)
sprite:setX(10)
sprite:set(&quot;x&quot;, 10)
sprite:set("x", 10)
-- the following two lines do the same thing
-- the following two lines do the same thing
sprite:setY(10)
sprite:setY(10)
sprite:set(&quot;y&quot;, 10)
sprite:set("y", 10)


-- the following two lines do the same thing
-- the following two lines do the same thing
sprite:setRotation(10)
sprite:setRotation(10)
sprite:set(&quot;rotation&quot;, 10)
sprite:set("rotation", 10)


-- the following two lines do the same thing
-- the following two lines do the same thing
sprite:setScaleX(0.5)
sprite:setScaleX(0.5)
sprite:set(&quot;scaleX&quot;, 0.5)
sprite:set("scaleX", 0.5)


-- the following two lines do the same thing
-- the following two lines do the same thing
sprite:setScaleY(0.5)
sprite:setScaleY(0.5)
sprite:set(&quot;scaleY&quot;, 0.5)
sprite:set("scaleY", 0.5)


-- the following two lines do the same thing
-- the following two lines do the same thing
sprite:setScale(0.5)
sprite:setScale(0.5)
sprite:set(&quot;scale&quot;, 0.5)</source>
sprite:set("scale", 0.5)</source>


{{Sprite}}
{{Sprite}}

Revision as of 10:02, 28 February 2020


Available since: Gideros 2011.6
Class: Sprite

Description


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



 Sprite:set(param,value)

Parameters

param: (string) The name of the parameter
value: (number) The new value of the specified parameter

Examples

Example

-- the following two lines do the same thing
sprite:setX(10)
sprite:set("x", 10)
		
-- the following two lines do the same thing
sprite:setY(10)
sprite:set("y", 10)

-- the following two lines do the same thing
sprite:setRotation(10)
sprite:set("rotation", 10)

-- the following two lines do the same thing
sprite:setScaleX(0.5)
sprite:set("scaleX", 0.5)

-- the following two lines do the same thing
sprite:setScaleY(0.5)
sprite:set("scaleY", 0.5)

-- the following two lines do the same thing
sprite:setScale(0.5)
sprite:set("scale", 0.5)