Compare commits

...

3 Commits

Author SHA1 Message Date
En Yi 8ae999ccc8 Tweak water rendering
make water rendering in front of all entities
2023-11-18 20:13:02 +08:00
En Yi de5da9a5f2 Increase lifetime for bomb crates 2023-11-18 20:12:39 +08:00
En Yi cb67dcf81f Fix incorrect parsing of emitter config 2023-11-18 20:02:00 +08:00
3 changed files with 39 additions and 16 deletions

View File

@ -52,7 +52,7 @@ static bool parse_emitter_info(char* emitter_info_str, EmitterConfig_t* conf)
if (data_count == 8)
{
conf->type = (emitter_type == 'b') ? EMITTER_BURST : EMITTER_UNKNOWN;
conf->one_shot = (one_shot == 1);
conf->one_shot = (one_shot == '1');
}
return data_count == 8;
}

View File

@ -274,17 +274,6 @@ static void render_editor_game_scene(Scene_t* scene)
}
}
// Draw water tile
uint32_t water_height = tilemap.tiles[i].water_level * WATER_BBOX_STEP;
// Draw water tile
Color water_colour = ColorAlpha(BLUE, 0.5);
DrawRectangle(
x,
y + (TILE_SIZE - water_height),
TILE_SIZE,
water_height,
water_colour
);
if (tilemap.tiles[i].max_water_level < MAX_WATER_LEVEL)
{
DrawRectangleLinesEx((Rectangle){x, y, TILE_SIZE, TILE_SIZE}, 2.0, ColorAlpha(BLUE, 0.5));
@ -438,6 +427,27 @@ static void render_editor_game_scene(Scene_t* scene)
DrawCircleV(p_ct->position, tilemap.tile_size >> 1, (data->coins.current < data->coins.total)? RED : GREEN);
}
for (int tile_y = min.y; tile_y < max.y; tile_y++)
{
for (int tile_x = min.x; tile_x < max.x; tile_x++)
{
int i = tile_x + tile_y * tilemap.width;
int x = tile_x * TILE_SIZE;
int y = tile_y * TILE_SIZE;
uint32_t water_height = tilemap.tiles[i].water_level * WATER_BBOX_STEP;
// Draw water tile
Color water_colour = ColorAlpha(BLUE, 0.5);
DrawRectangle(
x,
y + (TILE_SIZE - water_height),
TILE_SIZE,
water_height,
water_colour
);
}
}
sc_map_foreach_value(&scene->ent_manager.entities_map[DYNMEM_ENT_TAG], p_ent)
{
CWaterRunner_t* p_runner = get_component(p_ent, CWATERRUNNER_T);

View File

@ -1623,9 +1623,7 @@ void hitbox_update_system(Scene_t* scene)
CBBox_t* p_bbox = get_component(p_ent, CBBOX_COMP_T);
CPlayerState_t* p_pstate = get_component(p_ent, CPLAYERSTATE_T);
if (
p_pstate != NULL
)
if (p_pstate != NULL)
{
if (p_ctransform->position.y + p_bbox->size.y <= p_other_ct->position.y)
{
@ -1660,7 +1658,22 @@ void hitbox_update_system(Scene_t* scene)
{
remove_component(p_other_ent, CHURTBOX_T);
CLifeTimer_t* p_clifetimer = add_component(p_other_ent, CLIFETIMER_T);
p_clifetimer->life_time = 3;
if (p_other_ent->m_tag == CRATES_ENT_TAG)
{
CContainer_t* p_container = get_component(p_other_ent, CCONTAINER_T);
if (p_container->item == CONTAINER_BOMB)
{
p_clifetimer->life_time = 6;
}
else
{
p_clifetimer->life_time = 3;
}
}
else
{
p_clifetimer->life_time = 3;
}
}
}
else