From abeff178c623c7ef0baa82ef7fae4b351e874dae Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Wed, 29 Jan 2025 02:56:21 +0000 Subject: [PATCH] fix bug of enemy occasionally dropping off platform occasionally (incorrect int comparison in getMoveLeftPatches function) --- fcore/enemy-behaviour.sml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fcore/enemy-behaviour.sml b/fcore/enemy-behaviour.sml index bf81fe5..90e575e 100644 --- a/fcore/enemy-behaviour.sml +++ b/fcore/enemy-behaviour.sml @@ -344,7 +344,8 @@ struct val yDiff = platY - apexY in - if yDiff > xDiff then + if yDiff <= xDiff then + (* enemy can reach platform by jumping *) let val acc = if standingOnArea (enemy, platformTree) then @@ -368,7 +369,7 @@ struct val yDiff = platY - ey in if yDiff >= xDiff then - (* can reach next platform by simply dropping and moving right *) + (* can reach next platform by simply dropping and moving left *) EnemyPatch.W_Y_AXIS DROP_BELOW_PLATFORM :: EnemyPatch.W_X_AXIS MOVE_LEFT :: acc else @@ -380,7 +381,7 @@ struct val apexY = ey - (Constants.jumpLimit - jumpAmt) val yDiff = platY - apexY in - if yDiff >= xDiff then + if yDiff <= xDiff then (* can reach if we jump and move left *) let val acc =