RenderSpriteState
From OxeyeWiki
(Difference between revisions)
(→Example) |
|||
| Line 20: | Line 20: | ||
=== Example === | === Example === | ||
<pre> | <pre> | ||
| + | |||
| + | local a,r,g,b = 255, 255, 255, 255 | ||
if player.isHurt then | if player.isHurt then | ||
-- tint the player with red color | -- tint the player with red color | ||
| - | + | g,b = 64, 64 | |
| - | + | ||
| - | + | ||
end | end | ||
| + | |||
| + | video.renderSpriteState(player.sprite, player.x, player.y, 1.0, 0, a, r, g, b, player.isFacingLeft) | ||
</pre> | </pre> | ||
Latest revision as of 20:35, 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
local a,r,g,b = 255, 255, 255, 255
if player.isHurt then
-- tint the player with red color
g,b = 64, 64
end
video.renderSpriteState(player.sprite, player.x, player.y, 1.0, 0, a, r, g, b, player.isFacingLeft)