RenderSpriteState

From OxeyeWiki

(Difference between revisions)
Jump to: navigation, search
m
(Example)
 
(One intermediate revision not shown)
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.
Line 19: 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
-
       video.renderSpriteState(player.sprite, player.x, player.y, 1.0, 0, 255, 255, 64, 64)
+
       g,b = 64, 64
-
  else
+
-
      video.renderSpriteState(player.sprite, player.x, player.y)
+
   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.

Daisymoon Video Lib

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)

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox