Tweak ledge sensor to prevent balancing on ramps

This commit is contained in:
Lucas S. Vieira 2025-01-07 12:42:31 -03:00
parent 68c9c2f40c
commit 83b44dafa6
2 changed files with 8 additions and 1 deletions

View file

@ -35,6 +35,7 @@
// Constants for adjusting hitbox and sensors
#define WIDTH_RADIUS_NORMAL 9
#define HEIGHT_RADIUS_NORMAL 19
#define LEDGE_SENSOR_MAGNITUDE 26
#define WIDTH_RADIUS_ROLLING 7
#define HEIGHT_RADIUS_ROLLING 14
#define PUSH_RADIUS 10

View file

@ -458,7 +458,8 @@ _player_update_collision_tb(Player *player)
if((player->vel.vz == 0) && (player->gsmode == CDIR_FLOOR)) {
CollisionEvent ev_ledge = linecast(&leveldata, &map128, &map16,
anchorx, anchory_left,
CDIR_FLOOR, grn_mag, CDIR_FLOOR);
CDIR_FLOOR, LEDGE_SENSOR_MAGNITUDE,
CDIR_FLOOR);
player->col_ledge = ev_ledge.collided;
}
@ -485,6 +486,11 @@ _player_update_collision_tb(Player *player)
_draw_sensor(anchorx_right, anchory_right,
grndir, grn_mag,
0x38, 0xff, 0xa2);
if((player->vel.vz == 0) && (player->gsmode == CDIR_FLOOR)) {
_draw_sensor(anchorx, anchory_right,
CDIR_FLOOR, LEDGE_SENSOR_MAGNITUDE,
0x1c, 0xf7, 0x51);
}
}
/* HANDLE COLLISION */