RenderSpriteState
From OxeyeWiki
(Difference between revisions)
				
																
				
				
								
				m  | 
		|||
| Line 1: | Line 1: | ||
{{VideoMethod  | {{VideoMethod  | ||
|  | |  | ||
| - | video.renderSpriteState(spriteId, x, y[, scale[, angle[, a, r, g, b]]])  | + | video.renderSpriteState(spriteId, x, y[, scale[, angle[, a, r, g, b [, mirrored]]]])  | 
|  | |  | ||
Renders a sprite at the given screen position.  | Renders a sprite at the given screen position.  | ||
| Line 14: | Line 14: | ||
{{MethodParam|g|Optional integer|The green pigment of the diffuse color, defaults to 255.}}  | {{MethodParam|g|Optional integer|The green pigment of the diffuse color, defaults to 255.}}  | ||
{{MethodParam|b|Optional integer|The blue pigment of the diffuse color, defaults to 255.}}  | {{MethodParam|b|Optional integer|The blue pigment of the diffuse color, defaults to 255.}}  | ||
| + | {{MethodParam|mirrored|Optional boolean|Set this to true if you want the image to be flipped.}}  | ||
|  | |  | ||
Returns nothing.  | Returns nothing.  | ||
Revision as of 20:34, 27 December 2009
| 
 video.renderSpriteState(spriteId, x, y[, scale[, angle[, a, r, g, b [, mirrored]]]])  | ||
| 
 Renders a sprite at the given screen position.  | ||
| Parameter | Expected Type | Description | 
| spriteId | An integer | The sprite ID. | 
| x | A number | The x coordinate for the sprite's hotspot. | 
| y | A number | The y coordinate for the sprite's hotspot. | 
| scale | Optional number | The scale of the sprite, defaults to 1.0. | 
| angle | Optional number | The angle (rotation) of the sprite, measured in radians. The sprite will rotate around its hotspot. | 
| a | Optional integer | The alpha component of the diffuse color. Use this to blend the sprite with the background. | 
| r | Optional integer | The red pigment of the diffuse color, defaults to 255. | 
| g | Optional integer | The green pigment of the diffuse color, defaults to 255. | 
| b | Optional integer | The blue pigment of the diffuse color, defaults to 255. | 
| mirrored | Optional boolean | Set this to true if you want the image to be flipped. | 
| Returns | ||
| 
 Returns nothing.  | ||
Example
   if player.isHurt then
      -- tint the player with red color
      video.renderSpriteState(player.sprite, player.x, player.y, 1.0, 0, 255, 255, 64, 64)
   else
      video.renderSpriteState(player.sprite, player.x, player.y)
   end