{{newin|[[11.0]]|110|type=function}}
Changes a sprite previously added with [[SpriteBatch:add|add]] or [[SpriteBatch:addLayer|addLayer]], in a batch created with an [[TextureType|Array Texture]].

== Function ==
Changes the sprite in the SpriteBatch.
=== Synopsis ===
<source lang="lua">
SpriteBatch:setLayer( spriteindex, layerindex, x, y, r, sx, sy, ox, oy, kx, ky )
</source>
=== Arguments ===
{{param|number|spriteindex|The index of the existing sprite to replace.}}
{{param|number|layerindex|The index of the layer in the Array Texture to use for this sprite.}}
{{param|number|x (0)|The position to draw the sprite (x-axis).}}
{{param|number|y (0)|The position to draw the sprite (y-axis).}}
{{param|number|r (0)|Orientation (radians).}}
{{param|number|sx (1)|Scale factor (x-axis).}}
{{param|number|sy (sx)|Scale factor (y-axis).}}
{{param|number|ox (0)|Origin offset (x-axis).}}
{{param|number|oy (0)|Origin offset (y-axis).}}
{{param|number|kx (0)|Shearing factor (x-axis).}}
{{param|number|ky (0)|Shearing factor (y-axis).}}
=== Returns ===
Nothing.

== Function ==
Adds a layer of the SpriteBatch's Array Texture using the specified [[Quad]].
=== Synopsis ===
<source lang="lua">
SpriteBatch:setLayer( spriteindex, layerindex, quad, x, y, r, sx, sy, ox, oy, kx, ky )
</source>
=== Arguments ===
{{param|number|spriteindex|The index of the existing sprite to replace.}}
{{param|number|layerindex|The index of the layer to use for this sprite.}}
{{param|Quad|quad|The subsection of the texture's layer to use when drawing the sprite.}}
{{param|number|x (0)|The position to draw the sprite (x-axis).}}
{{param|number|y (0)|The position to draw the sprite (y-axis).}}
{{param|number|r (0)|Orientation (radians).}}
{{param|number|sx (1)|Scale factor (x-axis).}}
{{param|number|sy (sx)|Scale factor (y-axis).}}
{{param|number|ox (0)|Origin offset (x-axis).}}
{{param|number|oy (0)|Origin offset (y-axis).}}
{{param|number|kx (0)|Shearing factor (x-axis).}}
{{param|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 ===
<source lang="lua">
SpriteBatch:setLayer( spriteindex, layerindex, transform )
</source>
=== Arguments ===
{{param|number|spriteindex|The index of the existing sprite to replace.}}
{{param|number|layerindex|The index of the layer to use for the sprite.}}
{{param|Transform|transform|A transform object.}}
=== Returns ===
Nothing.

== Function ==
Adds a layer of the SpriteBatch's Array Texture using the specified [[Quad]] and [[Transform]].
=== Synopsis ===
<source lang="lua">
SpriteBatch:setLayer( spriteindex, layerindex, quad, transform )
</source>
=== Arguments ===
{{param|number|spriteindex|The index of the existing sprite to replace.}}
{{param|number|layerindex|The index of the layer to use for the sprite.}}
{{param|Quad|quad|The subsection of the texture's layer to use when drawing the sprite.}}
{{param|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 ==
* [[parent::SpriteBatch]]
* [[SpriteBatch:addLayer]]
* [[love.graphics.newArrayImage]]
* [[love.graphics.newCanvas]]
* [[love.graphics.newShader]]
* [[TextureType]]
[[Category:Functions]]
{{#set:Description=Changes a sprite previously added with [[SpriteBatch:add|add]] or [[SpriteBatch:addLayer|addLayer]], in a batch created with an [[TextureType|Array Texture]].}}

== Other Languages ==
{{i18n|SpriteBatch:setLayer}}