Asset get

This function will get the unique identifying index for a built-in asset (sprite, sound, object, font, or room). If the asset is not found, the function will return a value of  instead.

Syntax
asset_get( asset );

Returns
int (asset index)

Basic
// bair.gml // sets the sound effect assigned to the 3rd bair window set_window_value( AT_BAIR, 3, AG_WINDOW_SFX, asset_get( "sfx_swipe_medium1" ) );

Advanced
// update.gml // finds how many of Kragg's grounded rocks exist and gets their coordinates var number_of_rocks = instance_number( asset_get( "rock_obj" ) ); var rock_coords = array_create( number_of_rocks, 0 );

var i = 0; with asset_get( "rock_obj" ) { rock_coords[i] = [ get_instance_x( self ), get_instance_y( self ) ]; i++; }