diff --git a/scenes/game_systems.c b/scenes/game_systems.c index 640a2b8..f729d67 100644 --- a/scenes/game_systems.c +++ b/scenes/game_systems.c @@ -581,9 +581,8 @@ void player_bbox_update_system(Scene_t* scene) } CHitBoxes_t* p_hitbox = get_component(p_player, CHITBOXES_T); - p_hitbox->boxes[0].height = p_bbox->size.y + 2; - //p_hitbox->boxes[1].y = p_bbox->size.y / 4; - p_hitbox->boxes[1].height = p_bbox->size.y - 1; + p_hitbox->boxes[0].height = p_bbox->size.y + 4; + p_hitbox->boxes[1].height = p_bbox->size.y; CHurtbox_t* p_hurtbox = get_component(p_player, CHURTBOX_T); p_hurtbox->size = p_bbox->size; } @@ -1592,8 +1591,8 @@ void hitbox_update_system(Scene_t* scene) unsigned int tile_x1 = (hitbox_pos.x) / TILE_SIZE; unsigned int tile_y1 = (hitbox_pos.y) / TILE_SIZE; - unsigned int tile_x2 = (hitbox_pos.x + p_hitbox->boxes[i].width - 1) / TILE_SIZE; - unsigned int tile_y2 = (hitbox_pos.y + p_hitbox->boxes[i].height - 1) / TILE_SIZE; + unsigned int tile_x2 = (hitbox_pos.x + p_hitbox->boxes[i].width) / TILE_SIZE; + unsigned int tile_y2 = (hitbox_pos.y + p_hitbox->boxes[i].height) / TILE_SIZE; tile_x2 = (tile_x2 >= tilemap.width) ? tilemap.width - 1 : tile_x2; tile_y2 = (tile_y2 >= tilemap.height) ? tilemap.width - 1 : tile_y2; diff --git a/scenes/player_ent.c b/scenes/player_ent.c index fbd973d..f575b57 100644 --- a/scenes/player_ent.c +++ b/scenes/player_ent.c @@ -81,15 +81,15 @@ Entity_t* create_player(EntityManager_t* ent_manager) p_hitbox->n_boxes = 2; p_hitbox->boxes[0] = (Rectangle) { .x = 0, - .y = -1, - .width = p_bbox->size.x - 1, - .height = p_bbox->size.y + 2, + .y = -2, + .width = p_bbox->size.x, + .height = p_bbox->size.y + 4, }; p_hitbox->boxes[1] = (Rectangle) { - .x = -1, + .x = -2, .y = 0, - .width = p_bbox->size.x + 2, - .height = p_bbox->size.y - 1, + .width = p_bbox->size.x + 4, + .height = p_bbox->size.y, }; p_hitbox->atk = 2; CHurtbox_t* p_hurtbox = add_component(p_ent, CHURTBOX_T);