By George — February 11, 2018
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).
Argument | Type | Description |
---|
index | :real | Index of the function call, must be between 0 and 24 |
high_value | :real | The high end of the range from which the random number will be selected |
floored | :real | If the number returned should only be a whole number |
Example, called from update.gml:
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!
Categories: Functions, Programming, Workshop | Comments: 0
By George — February 11, 2018
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();
}
Categories: Functions, Programming, Workshop | Comments: 0
By George — February 11, 2018
Draws text to the screen.
Argument | Type | Description |
---|
x | :real | The x position the text will be drawn at |
y | :real | The y position the text will be drawn at |
text | :string | The text to draw |
Example, called from post_draw.gml:
draw_debug_text( x, y - 20, string( state ));
Categories: Functions, Programming, Workshop | Comments: 0
By George — February 11, 2018
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.
Argument | Type | Description |
---|
asset | :string | The name of the game asset to get the index of |
Example, called from bair.gml:
set_window_value( AT_BAIR, 3, AG_WINDOW_SFX, asset_get( "sfx_swipe_medium1" ));
Categories: Functions, Programming, Workshop | Comments: 0
By George — February 11, 2018
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→
Argument | Type | Description |
---|
ID | :real | The instance ID or object_index to destroy (optional, default is the calling instance) |
Example, called from article1_update.gml:
if (y > room_height + 100) {
instance_destroy();
}
Example, called from update.gml:
var my_article = instance_create( x, y, "article1" );
instance_destroy( my_article );
Categories: Functions, Programming, Workshop | Comments: 0