News

music_fade

When called in a stage article, gradually decreases or increases the background music to the target volume.

Both arguments are optional; by default the music will fade to silence. Once the music is fully silent, background music playback will be stopped.

ArgumentTypeDescription
volume:real(optional)
The target music volume, with a range of 0 to 1.
amount_per_frame:real(optional)
Determines how much the volume decrements or increments per frame, with a range of 0 to 1.

Example 1, called from a stage’s update.gml:

// fade to silence at a rate of 0.01 per frame:
music_fade();

Example 2, called from a stage’s update.gml:

// fade to 10% volume at a rate of 0.025 per frame:
music_fade( 0.1, 0.025 );

music_set_volume

When called in a stage article, instantly changes the background music volume.

ArgumentTypeDescription
volume:realThe target music volume, with a range of 0 to 1.

Example, called from a stage’s update.gml:

// instantly set music volume to 50%:
music_set_volume( 0.5 );

music_stop

When called in a stage article, stops the current background music track.

Example, called from a stage’s update.gml:

// instantly stop music:
music_stop();

music_play_file

When called in a stage article, plays a background music track which replaces the currently playing music track.

ArgumentTypeDescription
file:stringThe file to load located in the /sounds directory.

Example, called from a stage’s update.gml:

// plays "my_song.ogg" located in the /sounds directory:
music_play_file( "my_song" );

Stage Articles

Stage articles behave similarly to normal articles, and this page will explain the differences between the two. For a reference on how articles work, check the Articles page.

Each custom stage has access to 3 types of stage articles: obj_stage_article, obj_stage_article_platform, and obj_stage_article_solid. The type of article created as well as the script set it uses (article1_init, article1_update, etc.) is dependent on spawners placed in the stage editor; the script set used is determined by the spawner number and the type of article is changeable in the editor’s properties menu. You can check which script set an article is using with the get_article_script function.

In addition to all of the variables shown in the normal articles page, stage articles also have these variables:

Variable Description
spawn_variables  an array of 8 variables passed from the spawner in the stage editor (ARG0 – ARG7).
parallax_x horizontal parallax, centered on the center of the stage.
parallax_y vertical parallax, centered on the center of the stage.

If you’re spawning a stage article using the instance_create function, you can add an optional argument to the end of it to change which script set the spawned article uses. For example, if you want to spawn a stage platform that uses article5_init, the function would look like this:

instance_create(x, y, “obj_stage_article_platform”, 5);