draw_background_part_ext

Draws part of a background at a given position with scaling, blending and alpha options.

Syntax:

draw_background_part_ext(back, left, top, width, height, x, y, xscale, yscale, colour, alpha);


Argument Description
back The index of the background to draw.
left The x position on the background of the top left corner of the area to draw.
top The y position on the background of the top left corner of the area to draw.
width The width of the area to draw.
height The height of the area 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.
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 a part of the chosen background at the given position following the same rules as per draw_background_part, only now you can scale the part, blend a colour with it, or change its alpha when drawing it to the screen (the same as when drawing a background with draw_background_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, 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:

draw_background_part_ext(bck_Sky, 8, 8, 32, 32, x, y, 2, 0.5, c_black, 1);

This will draw a 32x32 pixel area from 8x8 pixels into bck_Sky. It will be stretched to double its usual width but half its usual height. It will be opaque and it will be blended with black (turning it into a silhouette).


Back: Drawing Sprites And Backgrounds
Next: draw_background_stretched
© Copyright YoYo Games Ltd. 2018 All Rights Reserved