» Uncategorized Posts

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

spawn_hit_fx

Spawns a visual effect at the specified position.

ArgumentTypeDescription
x:realThe x position to spawn effect at
y:realThe y position to spawn effect at
hit_fx_index:realThe ID of a built-in visual effect or a custom effect previously created with hit_fx_create( sprite_index, animation_length ) Reference→

Example, called from update.gml:

// spawns a visual effect at the beginning of 4th Fspecial window:
if (attack == AT_FSPECIAL && window == 4 && window_timer == 1) {
spawn_hit_fx( x, y, my_custom_hit_fx );
}

hit_fx_create

Creates a visual effect to be used with your custom character. Returns the index of visual effect, to be stored for later use. This function permanently stores the data of the visual effect, so be sure to only call it once per effect, not anywhere that runs every frame (like update.gml).

Use either

asset_get( sprite )  Reference→
sprite_get( sprite )  Reference→

to retrieve the sprite ID.

ArgumentTypeDescription
sprite_index:realThe ID of the sprite to be used as a visual effect
animation_length:realThe length of the effect animation, in frames

Example, called from init.gml:

// creates a 30 frame explosion effect:
cool_effect = hit_fx_create( sprite_get( "cool_explosion" ), 30 );

Then in dspecial.gml:

// assigns the explosion effect to dspecial:
set_hitbox_value( AT_DSPECIAL, 1, HG_VISUAL_EFFECT, cool_effect );

You can also manually spawn the effect from, say, update.gml:

// spawns the custom effect at the specified position:
spawn_hit_fx( x, y, cool_effect );

can_tap_jump

Used in combination with tap_jump_pressed to check if tap jump is pressed.

Example, called from attack_update.gml:

// window 3 transitions into window 4 when pressing jump:
if (window == 3 && (jump_pressed || (tap_jump_pressed && can_tap_jump() ))){
window = 4;
window_timer = 0;
}

clear_button_buffer

Clears the input buffer for the specified action.

ArgumentTypeDescription
input_index:realThe input buffer to clear

Indexes Reference

Example, called from atack_update.gml:

// allows the attack to cancel immediately into the aerial idle state using the shield button without buffering an airdodge:
if (window == 2 && shield_pressed) {
set_state( PS_IDLE_AIR );
clear_button_buffer( PC_SHIELD_PRESSED );
}