Increase lifetime for bomb crates

scene_man
En Yi 2023-11-18 20:12:39 +08:00
parent cb67dcf81f
commit de5da9a5f2
1 changed files with 17 additions and 4 deletions

View File

@ -1623,9 +1623,7 @@ void hitbox_update_system(Scene_t* scene)
CBBox_t* p_bbox = get_component(p_ent, CBBOX_COMP_T); CBBox_t* p_bbox = get_component(p_ent, CBBOX_COMP_T);
CPlayerState_t* p_pstate = get_component(p_ent, CPLAYERSTATE_T); CPlayerState_t* p_pstate = get_component(p_ent, CPLAYERSTATE_T);
if ( if (p_pstate != NULL)
p_pstate != NULL
)
{ {
if (p_ctransform->position.y + p_bbox->size.y <= p_other_ct->position.y) if (p_ctransform->position.y + p_bbox->size.y <= p_other_ct->position.y)
{ {
@ -1660,10 +1658,25 @@ void hitbox_update_system(Scene_t* scene)
{ {
remove_component(p_other_ent, CHURTBOX_T); remove_component(p_other_ent, CHURTBOX_T);
CLifeTimer_t* p_clifetimer = add_component(p_other_ent, CLIFETIMER_T); CLifeTimer_t* p_clifetimer = add_component(p_other_ent, CLIFETIMER_T);
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; p_clifetimer->life_time = 3;
} }
} }
else else
{
p_clifetimer->life_time = 3;
}
}
}
else
{ {
// Need to remove immediately, otherwise will interfere with bomb spawning // Need to remove immediately, otherwise will interfere with bomb spawning
destroy_entity(scene, &tilemap, p_other_ent); destroy_entity(scene, &tilemap, p_other_ent);