Fix crates hitbox collision with player

scene_man
En Yi 2023-09-23 13:39:18 +08:00
parent e8ebe0f89c
commit e6784a4d71
2 changed files with 8 additions and 4 deletions

View File

@ -37,10 +37,14 @@ int main(void)
init_memory_pools();
init_assets(&engine.assets);
//load_from_infofile("res/assets.info.raw", &engine.assets);
//init_player_creation("res/player_spr.info", &engine.assets);
#ifndef NDEBUG
load_from_infofile("res/assets.info.raw", &engine.assets);
init_player_creation("res/player_spr.info", &engine.assets);
#else
load_from_rres("res/myresources.rres", &engine.assets);
init_player_creation_rres("res/myresources.rres", "player_spr.info", &engine.assets);
#endif
init_item_creation(&engine.assets);
LevelScene_t scene;

View File

@ -1485,7 +1485,7 @@ void hitbox_update_system(Scene_t* scene)
p_pstate != NULL
)
{
if (p_ctransform->position.y + p_bbox->size.y <= p_other_ct->position.y + p_other_bbox->half_size.y / 2)
if (p_ctransform->position.y + p_bbox->size.y <= p_other_ct->position.y)
{
p_ctransform->velocity.y = -400;
if (p_pstate->jump_pressed)
@ -1496,7 +1496,7 @@ void hitbox_update_system(Scene_t* scene)
p_cjump->jumped = true;
}
}
else if (p_ctransform->position.y > p_other_ct->position.y + p_other_bbox->half_size.y * 1.5)
else if (p_ctransform->position.y >= p_other_ct->position.y + p_other_bbox->size.y)
{
p_ctransform->velocity.y = 0;
}