create_deathbox

Creates a hitbox that instantly K.O.s any player that touches it.

ArgumentTypeDescription
x:realThe x coordinate of the center of the deathbox's desired position
y:realThe y coordinate of the center of the deathbox's desired position
w:realThe width of the deathbox, in pixels
h:realThe height of the deathbox, in pixels
player:realUsed to make the deathbox only hit a specific player.
Set to -1 if you want it to be able to hit all players.
Set to 0 if you want it to be able to hit all players except yourself
free:realIf set to false, it will only hit grounded players
shape:realThe sprite to use for the deathbox (same as the HG_SHAPE property in the hitbox grid):
0 = circle
1 = rectangle
2 = rounded rectangle
lifespan:realThe number of frames the deathbox stays active
bg_type:real[optional]
The screen effect to play when the deathbox hits someone:
0 = no screen effect
1 = purple screen effect
2 = red screen effect

Example, called from attack_update.gml:

// this attack creates a deathbox on top of the player that was hit by an earlier hitbox of the attack. This deathbox can only kill the hit player and will show the red screen effect on hit:
if (window == 3 && window_timer == 10 && has_hit_player) {
create_deathbox(
has_hit_id.x, // x
has_hit_id.y, // y
100, // w
100, // h
has_hit_id.player, // player
true, // free
1, // shape
3, // lifespan
2 // bg_type
);
}