Difference between revisions of "Sprite:set"

From GiderosMobile
Line 28: Line 28:
 
  Sprite:set(param,value)
 
  Sprite:set(param,value)
 
</source>
 
</source>
'''param''': (string) The name of the parameter ''''''<br/>
+
=== Parameters ===
'''value''': (number) The new value of the specified parameter ''''''<br/>
+
'''param''': (string) The name of the parameter <br/>
 +
'''value''': (number) The new value of the specified parameter <br/>
 +
=== Examples ===
 +
'''Example'''<br/>
 +
<source lang="lua">-- the following two lines do the same thing<br />
 +
sprite:setX(10)<br />
 +
sprite:set(&quot;x&quot;, 10)<br />
 +
<br />
 +
-- the following two lines do the same thing<br />
 +
sprite:setY(10)<br />
 +
sprite:set(&quot;y&quot;, 10)<br />
 +
<br />
 +
-- the following two lines do the same thing<br />
 +
sprite:setRotation(10)<br />
 +
sprite:set(&quot;rotation&quot;, 10)<br />
 +
<br />
 +
-- the following two lines do the same thing<br />
 +
sprite:setScaleX(0.5)<br />
 +
sprite:set(&quot;scaleX&quot;, 0.5)<br />
 +
<br />
 +
-- the following two lines do the same thing<br />
 +
sprite:setScaleY(0.5)<br />
 +
sprite:set(&quot;scaleY&quot;, 0.5)<br />
 +
<br />
 +
-- the following two lines do the same thing<br />
 +
sprite:setScale(0.5)<br />
 +
sprite:set(&quot;scale&quot;, 0.5)<br /></source>

Revision as of 11:45, 23 August 2018

Available since: Gideros 2011.6

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<br />
sprite:setX(10)<br />
sprite:set(&quot;x&quot;, 10)<br />
		<br />
-- the following two lines do the same thing<br />
sprite:setY(10)<br />
sprite:set(&quot;y&quot;, 10)<br />
<br />
-- the following two lines do the same thing<br />
sprite:setRotation(10)<br />
sprite:set(&quot;rotation&quot;, 10)<br />
<br />
-- the following two lines do the same thing<br />
sprite:setScaleX(0.5)<br />
sprite:set(&quot;scaleX&quot;, 0.5)<br />
<br />
-- the following two lines do the same thing<br />
sprite:setScaleY(0.5)<br />
sprite:set(&quot;scaleY&quot;, 0.5)<br />
<br />
-- the following two lines do the same thing<br />
sprite:setScale(0.5)<br />
sprite:set(&quot;scale&quot;, 0.5)<br />