Add hurtbox to player
Changelog: - Update player bbox update - Update hitbox update system to account for player - Reduce explosion size to allow better chaining behaviour - Reduce lifetime of destroyed cratesscene_man
parent
8c889690e8
commit
3a4671cecc
|
@ -456,6 +456,8 @@ void player_bbox_update_system(Scene_t* scene)
|
||||||
p_hitbox->boxes[0].height = p_bbox->size.y + 2;
|
p_hitbox->boxes[0].height = p_bbox->size.y + 2;
|
||||||
//p_hitbox->boxes[1].y = p_bbox->size.y / 4;
|
//p_hitbox->boxes[1].y = p_bbox->size.y / 4;
|
||||||
p_hitbox->boxes[1].height = p_bbox->size.y - 1;
|
p_hitbox->boxes[1].height = p_bbox->size.y - 1;
|
||||||
|
CHurtbox_t* p_hurtbox = get_component(p_player, CHURTBOX_T);
|
||||||
|
p_hurtbox->size = p_bbox->size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1478,9 +1480,17 @@ void hitbox_update_system(Scene_t* scene)
|
||||||
|
|
||||||
if (p_ent->m_tag != PLAYER_ENT_TAG)
|
if (p_ent->m_tag != PLAYER_ENT_TAG)
|
||||||
{
|
{
|
||||||
remove_component(p_other_ent, CHURTBOX_T);
|
|
||||||
CLifeTimer_t* p_clifetimer = add_component(p_other_ent, CLIFETIMER_T);
|
if (p_other_ent->m_tag == PLAYER_ENT_TAG)
|
||||||
p_clifetimer->life_time = 8;
|
{
|
||||||
|
p_other_ent->m_alive = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
remove_component(p_other_ent, CHURTBOX_T);
|
||||||
|
CLifeTimer_t* p_clifetimer = add_component(p_other_ent, CLIFETIMER_T);
|
||||||
|
p_clifetimer->life_time = 6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -190,9 +190,9 @@ Entity_t* create_explosion(EntityManager_t* ent_manager, Assets_t* assets)
|
||||||
CTransform_t* p_ctransform = add_component(p_explosion, CTRANSFORM_COMP_T);
|
CTransform_t* p_ctransform = add_component(p_explosion, CTRANSFORM_COMP_T);
|
||||||
p_ctransform->movement_mode = KINEMATIC_MOVEMENT;
|
p_ctransform->movement_mode = KINEMATIC_MOVEMENT;
|
||||||
p_ctransform->active = true;
|
p_ctransform->active = true;
|
||||||
p_ctransform->position.x -= 24;
|
p_ctransform->position.x -= 16;
|
||||||
p_ctransform->position.y -= 24;
|
p_ctransform->position.y -= 16;
|
||||||
p_hitbox->boxes[0] = (Rectangle){0, 0, TILE_SIZE + 48, TILE_SIZE + 48};
|
p_hitbox->boxes[0] = (Rectangle){0, 0, TILE_SIZE + 32, TILE_SIZE + 32};
|
||||||
|
|
||||||
CSprite_t* p_cspr = add_component(p_explosion, CSPRITE_T);
|
CSprite_t* p_cspr = add_component(p_explosion, CSPRITE_T);
|
||||||
p_cspr->sprites = item_sprite_map;
|
p_cspr->sprites = item_sprite_map;
|
||||||
|
|
|
@ -90,6 +90,9 @@ Entity_t* create_player(EntityManager_t* ent_manager, Assets_t* assets)
|
||||||
.height = p_bbox->size.y - 1,
|
.height = p_bbox->size.y - 1,
|
||||||
};
|
};
|
||||||
p_hitbox->atk = 2;
|
p_hitbox->atk = 2;
|
||||||
|
CHurtbox_t* p_hurtbox = add_component(p_ent, CHURTBOX_T);
|
||||||
|
p_hurtbox->size = p_bbox->size;
|
||||||
|
|
||||||
CSprite_t* p_cspr = add_component(p_ent, CSPRITE_T);
|
CSprite_t* p_cspr = add_component(p_ent, CSPRITE_T);
|
||||||
p_cspr->sprites = player_sprite_map;
|
p_cspr->sprites = player_sprite_map;
|
||||||
p_cspr->transition_func = &player_sprite_transition_func;
|
p_cspr->transition_func = &player_sprite_transition_func;
|
||||||
|
|
Loading…
Reference in New Issue