From 1c4ff62744fbd9cfda8788984c9dce53944b0646 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sun, 26 Jan 2025 23:32:20 +0000 Subject: [PATCH] small amendment to getPatrolPatches: make sure enemy is always fully on platform while patrolling (does not go off edge) as this is more predictable + looks better --- fcore/enemy-behaviour.sml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fcore/enemy-behaviour.sml b/fcore/enemy-behaviour.sml index 54c858d..e1c2111 100644 --- a/fcore/enemy-behaviour.sml +++ b/fcore/enemy-behaviour.sml @@ -7,10 +7,9 @@ struct val ww = Constants.worldWidth val wh = Constants.worldHeight - val searchWidth = Constants.enemySize - val y = y + Constants.enemySize - 5 val searchHeight = 10 + val searchWidth = Constants.moveEnemyBy in QuadTree.hasCollisionAt (x, y, searchWidth, searchHeight, 0, 0, ww, wh, ~1, wallTree) @@ -66,7 +65,7 @@ struct let (* search to see if there is wall on left side *) val searchStartX = x - Constants.moveEnemyBy - val searchWidth = Constants.enemySize + val searchWidth = Constants.moveEnemyBy val searchHeight = Constants.enemySize - 5 val ww = Constants.worldWidth @@ -100,7 +99,7 @@ struct * but we want to check top * right coordinate, * so add enemySize *) val searchStartX = x + Constants.enemySize + Constants.moveEnemyBy - val searchWidth = Constants.enemySize + val searchWidth = Constants.moveEnemyBy val searchHeight = Constants.enemySize - 5 val ww = Constants.worldWidth