» Uncategorized Posts

get_instance_x

Returns the x value of the specified instance. Used for referencing objects that you normally don’t have access to.

ArgumentTypeDescription
instance_id:realThe ID of the instance to get the x value of

Example, called from article1_update.gml:

// destroys the article when it’s within Clairen’s plasma field:
with (asset_get( "plasma_field_obj" )) {
with (other.id) {
if (point_distance(
x + 10 * spr_dir,
y,
get_instance_x( other ),
get_instance_y( other )
) < 180) {
instance_destroy();
}
}
}

set_victory_bg

Overwrites character’s victory background. Can be assigned to a 480x270px custom sprite using

sprite_get( sprite )  Reference→

or set to one of the following indexes

ArgumentTypeDescription
bg:realVictory background index or custom sprite ID

Example, called from load.gml:

set_victory_bg( sprite_get( "custom" ));

get_stage_data

Returns the size of the specified part of the stage.

ArgumentTypeDescription
index:realThe data to get

Indexes Reference

Example, called from update.gml:

// // keeps track of how long the player is offstage:
var stage_x = get_stage_data( SD_X_POS );
if (x < stage_x || x > room_width - stage_x){
offstage_timer++;
} else {
offstage_timer = 0;
}

get_game_timer

Returns the number of frames remaining in the match.

Example, called from hit_player.gml:

// this character deals extra knockback in the last minute of a match:
if (get_game_timer() < 60 * 60) { // there are 60 frames in one second
hit_player_obj.old_hsp *= 1.2;
hit_player.obj.old_vsp *= 1.2;
}

get_gameplay_time

Returns the number of frames since the match started.

Example, called from post_draw.gml:

// draws a fire sprite on top of the player that animates at 10 frames per second. Using the gameplay timer as a base for the fire's image index allows it to animate at a consistent speed without creating a new local variable on the player:
if (on_fire) {
var fire_image = get_gameplay_time() / 6;
draw_sprite( fire_sprite, fire_image, x, y );
}