draw_background_ext

Draws a background at a given position, with customizable scaling, rotation, blend and alpha.

Syntax:

GML Code Example

draw_background_ext(back, x, y, xscale, yscale, rot, colour, alpha);


Argument Description
back The index of the background to draw.
x The x coordinate of where to draw the background.
y The y coordinate of where to draw the background.
xscale The horizontal scaling of the background.
yscale The vertical scaling of the background.
rot The rotation of the background.
colour The colour with which to blend the background (use -1 or c_white to display it normally).
alpha The alpha of the background (from 0 to 1 where 0 is transparent and 1 opaque).


Returns: N/A


Description

This function will draw the given background as in the function draw_background but with additional options to change the scale, blending, rotation and alpha of the background being drawn. Changing these values does not modify the resource in any way (only how it is drawn), and you can use any of the available background variables instead of direct values for all the arguments in the function.

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, and still require blended images, then you should consider using sprites and setting the sprite cache to help limit performance issues - see sprite_set_cache_size.


Example:

GML Code Example

draw_background_ext(bck_Sky, 0, 0, background_xscale[0], background_yscale[0], 0, c_red, 0.5);

The above code will draw a background at the (0,0) position in the room, with the same scale as the background indexed in background[0], blended red and semi transparent.





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