Compare commits
2 Commits
87b2db4ea4
...
5ddb9f00ca
Author | SHA1 | Date |
---|---|---|
|
5ddb9f00ca | |
|
0966c3ce29 |
|
@ -232,25 +232,6 @@ void player_movement_input_system(Scene_t* scene)
|
|||
|
||||
}
|
||||
|
||||
// Friction
|
||||
if (in_water)
|
||||
{
|
||||
// Apply water friction
|
||||
// Consistent in all direction
|
||||
p_ctransform->accel = Vector2Add(
|
||||
p_ctransform->accel,
|
||||
Vector2Scale(p_ctransform->velocity, -5.5)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// For game feel, y is set to air resistance only
|
||||
// x is set to ground resistance (even in air)
|
||||
// If not, then player is can go faster by bunny hopping
|
||||
// which is fun but not quite beneficial here
|
||||
p_ctransform->accel.x += p_ctransform->velocity.x * -3.3;
|
||||
p_ctransform->accel.y += p_ctransform->velocity.y * -1;
|
||||
}
|
||||
p_pstate->player_dir.x = 0;
|
||||
p_pstate->player_dir.y = 0;
|
||||
}
|
||||
|
@ -481,7 +462,14 @@ void tile_collision_system(Scene_t *scene)
|
|||
CTransform_t *p_other_ct = get_component(&scene->ent_manager, p_other_ent, CTRANSFORM_COMP_T);
|
||||
if (p_ctransform->position.y + p_bbox->size.y <= p_other_ct->position.y)
|
||||
{
|
||||
p_ctransform->velocity.y = (p_pstate->jump_pressed)? -600 : -400;
|
||||
p_ctransform->velocity.y = -400;
|
||||
if (p_pstate->jump_pressed)
|
||||
{
|
||||
p_ctransform->velocity.y = -600;
|
||||
CJump_t * p_cjump = get_component(&scene->ent_manager, p_ent, CJUMP_COMP_T);
|
||||
p_cjump->short_hop = false;
|
||||
p_cjump->jumped = true;
|
||||
}
|
||||
}
|
||||
remove_entity(&scene->ent_manager, other_ent_idx);
|
||||
}
|
||||
|
@ -559,6 +547,25 @@ void global_external_forces_system(Scene_t *scene)
|
|||
}
|
||||
p_ctransform->accel = Vector2Add(p_ctransform->accel, GRAVITY);
|
||||
}
|
||||
// Friction
|
||||
if (p_mstate->water_state & 1)
|
||||
{
|
||||
// Apply water friction
|
||||
// Consistent in all direction
|
||||
p_ctransform->accel = Vector2Add(
|
||||
p_ctransform->accel,
|
||||
Vector2Scale(p_ctransform->velocity, -5.5)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// For game feel, y is set to air resistance only
|
||||
// x is set to ground resistance (even in air)
|
||||
// If not, then player is can go faster by bunny hopping
|
||||
// which is fun but not quite beneficial here
|
||||
p_ctransform->accel.x += p_ctransform->velocity.x * -3.3;
|
||||
p_ctransform->accel.y += p_ctransform->velocity.y * -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -614,9 +621,7 @@ void player_ground_air_transition_system(Scene_t* scene)
|
|||
if (!in_water)
|
||||
p_cjump->cooldown_timer = 0;
|
||||
}
|
||||
|
||||
// TODO: Handle in water <-> out of water transition
|
||||
if (p_mstate->water_state == 0b10 || p_mstate->ground_state == 0b10)
|
||||
else if (p_mstate->water_state == 0b10 || p_mstate->ground_state == 0b10)
|
||||
{
|
||||
p_cjump->jumps -= (p_cjump->jumps > 0)? 1:0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue