background_create_colour

Creates a new background of a given size and colour.

Syntax:

background_create_colour(w, h, col);


Argument Description
w The width of the background.
h The height of the background.
col The colour to clear the background to.


Returns: Real


Description

This function creates a new background of the given width and height cleared to the given colour. The function returns the index of the newly created background and this should be stored in a variable and used in all further calls that require this background. If there is an error, the function returns -1.

NOTE: When you create a background dynamically with GameMaker: Studio you must remember to remove it again (with background_delete) when no longer needed, otherwise there is risk of a memory leak which will slow down and eventually crash your game.


Example:

t_back = background_create_colour(room_width, room_height, c_black);

The above code will create a new background the same size as the current room and colours it black. The index of this new background is stored in the variable "t_back".


Back: Backgrounds
Next: background_create_gradient
© Copyright YoYo Games Ltd. 2018 All Rights Reserved