background_exists

Determines whether a background exists or not.

Syntax:

background_exists(index);


Argument Description
index The index of the background to check.


Returns: N/A


Description

This function returns whether a background with the specified index exists or not. Please note, that the value used for checking must have been initialised previously or else you will get an error causing GameMaker: Studio to close.


Example:

if background_exists(bck_array[0])
   {
   background_index[0] = bck_array[0];
   }
else
   {
   background_index[0] = bck_Base;
   }

The above code checks an array to see if it contains a valid background index and if so it assigns that background to the current room, but if not, it assigns a background from the included resources.


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