draw_sprite_tiled_ext

Draws a sprite at a given position with scaling, blending and alpha, and tiles it to fill the entire view.

Syntax:

GML Code Example

draw_sprite_tiled_ext(sprite, subimg, x, y, xscale, yscale, colour, alpha);


Argument Description
sprite The index of the sprite to draw.
subimg The subimg (frame) of the sprite to draw (image_index or -1 correlate to the current frame of animation in the object).
x The x coordinate of where to draw the sprite.
y The y coordinate of where to draw the sprite.
xscale The horizontal scaling of the sprite. A multiplier ' 1 = normal scaling, 0.5 is half etc.
yscale The vertical scaling of the sprite. A multiplier ' 1 = normal scaling, 0.5 is half etc.
colour The colour with which to blend the sprite. c_white is to display it normally.
alpha The alpha of the sprite (from 0 to 1 where 0 is transparent and 1 opaque).


Returns: N/A


Description

This function will take a sprite and then repeatedly tile it across the whole view (or room if no view is defined), starting from the coordinates that you give in the function and with each tile scaled, colour blended and with the alpha that you define (these properties are the same as those used in draw_sprite_ext).

NOTE: Colour blending is only recommended for the HTML5 target when WebGL is enabled, although you can still set the blending colour if it is not enabled and it will blend the sprite as normal. However all blending in this way creates a duplicate sprite which is then stored in the cache and used when required. This is far from optimal and if you use multiple colour changes it will slow down your games performance unless you activate WebGL. if you do not wish to use WebGL, then you can set the font cache size to try and limit this should it be necessary using the function sprite_set_cache_size.


Example:

GML Code Example

draw_sprite_tiled_ext(sprite_index, image_index, x, y, 2, 2, c_red, 0.5);

This will draw the instances assigned sprite (sprite_index) and its current frame of animation (image_index) at the instances own x and y position, but scaled to twice the normal size, blended red and with half the normal alpha. The sprite will be tiled horizontally and vertically across the view.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here