Compare commits
No commits in common. "6005d3f490622a375a92ee534e84fec826670717" and "371e6fcbdfd24a5ac2c18633a6087019cf68971a" have entirely different histories.
6005d3f490
...
371e6fcbdf
|
@ -17,7 +17,8 @@
|
|||
|
||||
#define GRAV_ACCEL 1500
|
||||
#define JUMP_SPEED 70
|
||||
#define MOVE_ACCEL 1300
|
||||
#define MOVE_ACCEL 1000
|
||||
#define FRICTION 0.98
|
||||
|
||||
#ifndef TILE16_SIZE
|
||||
#define PLAYER_WIDTH 30
|
||||
|
@ -34,9 +35,8 @@
|
|||
#define PLAYER_C_XOFFSET (PLAYER_WIDTH - PLAYER_C_WIDTH)
|
||||
|
||||
#define PLAYER_MAX_SPEED 800
|
||||
#define WATER_FRICTION 7.5
|
||||
#define GROUND_X_FRICTION 5.8
|
||||
#define GROUND_Y_FRICTION 1.0
|
||||
#define Y_FRICTION 0.98
|
||||
#define X_FRICTION 0.85
|
||||
|
||||
#define MAX_WATER_LEVEL 4
|
||||
#endif // __CONSTANTS_H
|
||||
|
|
|
@ -802,7 +802,7 @@ void friction_coefficient_update_system(Scene_t* scene)
|
|||
{
|
||||
// Apply water friction
|
||||
// Consistent in all direction
|
||||
p_ct->fric_coeff = (Vector2){-WATER_FRICTION, -WATER_FRICTION};
|
||||
p_ct->fric_coeff = (Vector2){-5.5, -5.5};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -810,7 +810,7 @@ void friction_coefficient_update_system(Scene_t* scene)
|
|||
// 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_ct->fric_coeff = (Vector2){-GROUND_X_FRICTION, -GROUND_Y_FRICTION};
|
||||
p_ct->fric_coeff = (Vector2){-3.3, -1};
|
||||
}
|
||||
|
||||
CPlayerState_t* p_pstate = get_component(p_ent, CPLAYERSTATE_T);
|
||||
|
@ -917,7 +917,6 @@ void moveable_update_system(Scene_t* scene)
|
|||
float remaining_distance = p_moveable->target_pos.x - p_ctransform->position.x;
|
||||
if (fabs(remaining_distance) < 0.1)
|
||||
{
|
||||
p_ctransform->prev_position = p_moveable->prev_pos;
|
||||
p_ctransform->position = p_moveable->target_pos;
|
||||
p_moveable->gridmove = false;
|
||||
p_bbox->solid = true;
|
||||
|
@ -931,19 +930,13 @@ void moveable_update_system(Scene_t* scene)
|
|||
p_ctransform->position.x += (remaining_distance < -p_moveable->move_speed) ? -p_moveable->move_speed : remaining_distance;
|
||||
}
|
||||
}
|
||||
|
||||
// Intentional. Want this check even after a gridmove to allow gridmove after that
|
||||
if (!p_moveable->gridmove)
|
||||
else
|
||||
{
|
||||
if (p_ctransform->prev_velocity.y <= 0 && p_ctransform->prev_position.x == p_ctransform->position.x) continue;
|
||||
if (p_ctransform->prev_velocity.y <= 0) continue;
|
||||
|
||||
TileGrid_t tilemap = (CONTAINER_OF(scene, LevelScene_t, scene)->data).tilemap;
|
||||
Vector2 point_to_check = {
|
||||
.x = p_ctransform->position.x + p_bbox->half_size.x,
|
||||
.y = p_ctransform->position.y + p_bbox->size.y + 5 // 5 is arbitrary, just to make sure there's a little gap
|
||||
};
|
||||
int tile_x = point_to_check.x / TILE_SIZE;
|
||||
int tile_y = point_to_check.y / TILE_SIZE;
|
||||
int tile_x = (p_ctransform->position.x + p_bbox->half_size.x) / TILE_SIZE;
|
||||
int tile_y = (p_ctransform->position.y + p_bbox->size.y) / TILE_SIZE;
|
||||
if (tile_y >= tilemap.height) continue;
|
||||
|
||||
int tile_idx = tile_y * tilemap.width + tile_x;
|
||||
|
@ -956,14 +949,6 @@ void moveable_update_system(Scene_t* scene)
|
|||
sc_map_get_64v(&scene->ent_manager.component_map[CMOVEABLE_T], other_ent_idx);
|
||||
if (!sc_map_found(&scene->ent_manager.component_map[CMOVEABLE_T])) continue;
|
||||
|
||||
{
|
||||
Entity_t* other_ent = get_entity(&scene->ent_manager, other_ent_idx);
|
||||
CBBox_t* p_other_bbox = get_component(other_ent, CBBOX_COMP_T);
|
||||
CTransform_t* p_other_ct = get_component(other_ent, CTRANSFORM_COMP_T);
|
||||
Rectangle box = {p_other_ct->position.x, p_other_ct->position.y, p_other_bbox->size.x, p_other_bbox->size.y};
|
||||
if (!point_in_AABB(point_to_check, box)) continue;
|
||||
}
|
||||
|
||||
tile_x = (p_ctransform->position.x) / TILE_SIZE - 1;
|
||||
|
||||
if (tile_x >= 0 && tile_x < tilemap.width)
|
||||
|
|
Loading…
Reference in New Issue