S
soboka
Guest
Hey.
I have this ledge grab script, it work, but i have a bug. In this scripts the player when is on this object side, it will hang on the object side. The hang_height is the how many pixels below the ledge the player will hang, but when i tried several times, the player not hanging on the same position. Sometimes it hang on above or below than the hang_height. Anyone have any idea how to prevent this bug?
I have this ledge grab script, it work, but i have a bug. In this scripts the player when is on this object side, it will hang on the object side. The hang_height is the how many pixels below the ledge the player will hang, but when i tried several times, the player not hanging on the same position. Sometimes it hang on above or below than the hang_height. Anyone have any idea how to prevent this bug?
Code:
if(can_ledge_grab == true)
{
{
var mask_width = bbox_right - bbox_left;
var grabx = x + global.facing * (0.5 * mask_width + 1);
var graby = bbox_bottom - hang_height;
if(collision_point(grabx, graby + ySpeed,
oParClimbBblock, false, true) != noone)
{
if(collision_point(grabx, graby,
oParClimbBblock, false, true) == noone)
{
while(collision_point(grabx, y - hang_height + 0.5 * sprite_height,
oParClimbBblock, false, true) == noone)
{
y++;
}
state = PLAYER_STATE.ledge_grab;
exit;
}
}
}
}