» Uncategorized Posts

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" ));

instance_destroy

Destroys the specified instance. Calling the function with no arguments will destroy the instance that is currently in scope and running the code, but you can target a specific instance if you provide its ID, or you can target all instances of a particular object by using an object_index.

Available objects list→

ArgumentTypeDescription
ID:realThe instance ID or object_index to destroy (optional, default is the calling instance)

Example, called from article1_update.gml:

// destroys articles outside of bottom room border:
if (y > room_height + 100) {
instance_destroy();
}

Example, called from update.gml:

// creates and then destroys an instance of article object:
var my_article = instance_create( x, y, "article1" );
// ...
instance_destroy( my_article );