SpriteBatch:setLayer
Available since LÖVE 11.0
This function is not supported in earlier versions.
Changes a sprite previously added with add or addLayer, in a batch created with an Array Texture.
Function
Changes the sprite in the SpriteBatch.
Synopsis
SpriteBatch:setLayer( spriteindex, layerindex, x, y, r, sx, sy, ox, oy, kx, ky )
Arguments
number spriteindex
- The index of the existing sprite to replace.
number layerindex
- The index of the layer in the Array Texture to use for this sprite.
number x (0)
- The position to draw the sprite (x-axis).
number y (0)
- The position to draw the sprite (y-axis).
number r (0)
- Orientation (radians).
number sx (1)
- Scale factor (x-axis).
number sy (sx)
- Scale factor (y-axis).
number ox (0)
- Origin offset (x-axis).
number oy (0)
- Origin offset (y-axis).
number kx (0)
- Shearing factor (x-axis).
number ky (0)
- Shearing factor (y-axis).
Returns
Nothing.
Function
Adds a layer of the SpriteBatch's Array Texture using the specified Quad.
Synopsis
SpriteBatch:setLayer( spriteindex, layerindex, quad, x, y, r, sx, sy, ox, oy, kx, ky )
Arguments
number spriteindex
- The index of the existing sprite to replace.
number layerindex
- The index of the layer to use for this sprite.
Quad quad
- The subsection of the texture's layer to use when drawing the sprite.
number x (0)
- The position to draw the sprite (x-axis).
number y (0)
- The position to draw the sprite (y-axis).
number r (0)
- Orientation (radians).
number sx (1)
- Scale factor (x-axis).
number sy (sx)
- Scale factor (y-axis).
number ox (0)
- Origin offset (x-axis).
number oy (0)
- Origin offset (y-axis).
number kx (0)
- Shearing factor (x-axis).
number ky (0)
- Shearing factor (y-axis).
Returns
Nothing.
Notes
The specified layer index overrides any layer index set on the Quad via Quad:setLayer.
Function
Adds a layer of the SpriteBatch's Array Texture using the specified Transform.
Synopsis
SpriteBatch:setLayer( spriteindex, layerindex, transform )
Arguments
number spriteindex
- The index of the existing sprite to replace.
number layerindex
- The index of the layer to use for the sprite.
Transform transform
- A transform object.
Returns
Nothing.
Function
Adds a layer of the SpriteBatch's Array Texture using the specified Quad and Transform.
Synopsis
SpriteBatch:setLayer( spriteindex, layerindex, quad, transform )
Arguments
number spriteindex
- The index of the existing sprite to replace.
number layerindex
- The index of the layer to use for the sprite.
Quad quad
- The subsection of the texture's layer to use when drawing the sprite.
Transform transform
- A transform object.
Returns
Nothing.
Notes
The specified layer index overrides any layer index set on the Quad via Quad:setLayer.
See Also
- SpriteBatch
- SpriteBatch:addLayer
- love.graphics.newArrayImage
- love.graphics.newCanvas
- love.graphics.newShader
- TextureType
© 2006–2020 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/SpriteBatch:setLayer