News

random_func_2

Generates a random value between 0 and high_value, not including high_value. If called on the same frame with the same index, this function will always return the same value (making it replay-safe).

ArgumentTypeDescription
index:realIndex of the function call, must be between 0 and 200
high_value:realThe high end of the range from which the random number will be selected
floored:realIf the number returned should only be a whole number

Example, called from update.gml:

// creates 5 articles
// and sets their hsp and vsp to random whole numbers between 5 and 10:

for (var i = 0; i < 5; i++) {
var this_article = instance_create( x, y, "obj_article1" );
this_article.hsp = spr_dir * (5 + random_func_2( 2 * i, 6, true ) );
this_article.vsp = -5 - random_func_2( 2 * i + 1, 6, true );
}

Note that the first argument of each separate function call is different, otherwise they would return the same number!

random_func

Generates a random value between 0 and high_value, not including high_value. If called by the same player on the same frame with the same index, this function will always return the same value (making it replay-safe).

ArgumentTypeDescription
index:realIndex of the function call, must be between 0 and 24
high_value:realThe high end of the range from which the random number will be selected
floored:realIf the number returned should only be a whole number

Example, called from update.gml:

// sets both hsp and vsp to separate random numbers between -50 and 50:
hsp = -50 + random_func( 0, 100, false );
vsp = -50 + random_func( 1, 100, false );

Note that the first argument of each separate function call is different, otherwise they would return the same number!

trigger_b_reverse

When used in attack_update.gml, it will check for b-reverse inputs on specified attacks.

Example, called from attack_update.gml:

if (attack == AT_NSPECIAL
|| attack == AT_FSPECIAL
|| attack == AT_FSPECIAL_AIR
|| attack == AT_DSPECIAL_AIR) {
trigger_b_reverse();
}

draw_debug_text

Draws text to the screen.

ArgumentTypeDescription
x:realThe x position the text will be drawn at
y:realThe y position the text will be drawn at
text:stringThe text to draw

Example, called from post_draw.gml:

// draws current character's state:
draw_debug_text( x, y - 20, string( state ));

asset_get

Returns the unique index (real) for any built-in game asset – including sounds, objects, and sprites. Can be used, for example, to assign a specific sound effect to a character attack.

To get the index of a custom (loaded with your character) asset, use

sprite_get( sprite )  Reference→
sound_get( sound )  Reference→

functions instead.

ArgumentTypeDescription
asset:stringThe name of the game asset to get the index of

Example, called from 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" ));