» Uncategorized Posts

Colors.gml

This file is used to initialize your character’s alternate color palettes. Custom characters have 6 color slots by default, but they can have up to 16 by the use of set_num_palettes.

To make an alternate color palette, you must reference the default color palette of your character. To make this easier, you can create a table with every color used by the character, organized in rows of colors that will get recolored together.

Each row is a separate “shade” that will be recolored together (with a max of 8 rows). When setting up colors.gml, you need to define the “main color” for each row.

 

You want to choose the color closest to the average of each shade, while also avoiding extremely light or extremely dark colors.

 

Using set_color_profile_slot( color_slot, shade_slot, R, G, B ) initialize color slot 0 with the RGB values of each main color:

// DEFAULT COLOR (R, G, B)
set_color_profile_slot( 0, 0, 51, 102, 52 ); // Dark greens
set_color_profile_slot( 0, 1, 178, 205, 152 ); // Light greens
set_color_profile_slot( 0, 2, 136, 104, 93 ); // Browns

Now you will need to define the “range” for each shade so the shader knows what colors are related to the main colors. Any color whose HSV values are all within the defined range relative to the main color will be considered “related colors”. For example, the HSV values of the top row of the example colors are:

(140°, 40%, 58%) (121°, 50%, 40%) (122°, 50%, 25%)

Relative to the main color, the largest hue difference is 19 (140 – 121), so we want to set the hue range to 20 (always add 1 to account for rounding). Then the saturation range should be 11 (50 – 40 + 1) and the value range should be 19 (58 – 40 + 1). So you would have this line in colors.gml:

set_color_profile_slot_range( 0, 20, 11, 19 );

Note: hue is a looping value, so the difference between a hue of 350° and a hue of 10° is only 20°, not 340°.

Repeat this process for each row and you’ll be ready to start creating alternate color palettes by calling set_color_profile_slot for slots 1 through 5 like this:

// Blue Color
set_color_profile_slot( 1, 0, 65, 111, 153 );
set_color_profile_slot( 1, 1, 169, 196, 222 );
set_color_profile_slot( 1, 2, 171, 182, 185 );
 
// Red Color
set_color_profile_slot( 2, 0, 146, 44, 44 );
set_color_profile_slot( 2, 1, 216, 175, 175 );
set_color_profile_slot( 2, 2, 94, 82, 79 );
 
// etc.

Available Objects

The objects that you can access their variables and use inside these functions:

instance_create( x, y, object )  Reference→

instance_destroy( ID )  Reference→

pHitBox
pHurtBox
oPlayer
oTestPlayer
the player object when playtesting
hit_fx_obj
obj_article1
obj_article2
obj_article3
obj_article_solid
obj_article_platform

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

create_hitbox

Creates a hitbox at (x, y) pulling from the attack data of the specified hitbox.

ArgumentTypeDescription
attack:realThe attack to get the hitbox data from
hitbox_num:realThe index of the hitbox to get the data from
x:realThe x coordinate to create the hitbox at
y:realThe y coordinate to create the hitbox at

Example, called from article1_update.gml:

// this article creates a hitbox (the owner's 1st Dspecial hitbox) any time it's close to its owner:
if (point_distance( x, y, owner.x, owner.y ) < 32 && cooldown_timer == 0) { create_hitbox( AT_DSPECIAL, 1, x, y - 40 );
cooldown_timer = 60;
}