Fix Boulder landing playing on spawning

Done by setting its ground state to 1. For consistency, this is
done to any entity that can 'land'. So far, this has no tangible
gameplay effects.
scene_man
En Yi 2023-11-13 11:34:39 +08:00
parent cdb9d22e6c
commit c78dc50f50
3 changed files with 12 additions and 3 deletions

View File

@ -498,6 +498,8 @@ void player_movement_input_system(Scene_t* scene)
{
// the else if check is to prevent playing the landing sfx
// on first frame jumps
// This is also why this is done here instead of in the
// state transition function
play_sfx(scene->engine, PLAYER_LAND_SFX);
}
}

View File

@ -46,7 +46,10 @@ Entity_t* create_crate(EntityManager_t* ent_manager, bool metal, ContainerItem_t
CTransform_t* p_ctransform = add_component(p_crate, CTRANSFORM_COMP_T);
p_ctransform->grav_delay = 7;
p_ctransform->shape_factor = metal ? (Vector2){0.7,0.7} : (Vector2){0.8,0.8} ;
add_component(p_crate, CMOVEMENTSTATE_T);
CMovementState_t* p_move = add_component(p_crate, CMOVEMENTSTATE_T);
p_move->ground_state |= 3;
add_component(p_crate, CTILECOORD_COMP_T);
CHurtbox_t* p_hurtbox = add_component(p_crate, CHURTBOX_T);
p_hurtbox->size = p_bbox->size;
@ -89,7 +92,9 @@ Entity_t* create_boulder(EntityManager_t* ent_manager)
p_ctransform->grav_delay = 5;
p_ctransform->active = true;
p_ctransform->shape_factor = (Vector2){0.6, 0.6};
add_component(p_boulder, CMOVEMENTSTATE_T);
CMovementState_t* p_move = add_component(p_boulder, CMOVEMENTSTATE_T);
p_move->ground_state |= 3;
add_component(p_boulder, CTILECOORD_COMP_T);
CMoveable_t* p_cmove = add_component(p_boulder, CMOVEABLE_T);
p_cmove->move_speed = 8;

View File

@ -74,7 +74,9 @@ Entity_t* create_player(EntityManager_t* ent_manager)
p_cjump->jump_ready = true;
add_component(p_ent, CPLAYERSTATE_T);
add_component(p_ent, CTILECOORD_COMP_T);
add_component(p_ent, CMOVEMENTSTATE_T);
CMovementState_t* p_move = add_component(p_ent, CMOVEMENTSTATE_T);
p_move->ground_state |= 3;
CHitBoxes_t* p_hitbox = add_component(p_ent, CHITBOXES_T);
p_hitbox->n_boxes = 2;
p_hitbox->boxes[0] = (Rectangle) {