diff --git a/fcore/enemy-behaviour.sml b/fcore/enemy-behaviour.sml index 9eeea8c..5903744 100644 --- a/fcore/enemy-behaviour.sml +++ b/fcore/enemy-behaviour.sml @@ -300,10 +300,10 @@ struct if yDiff > xDiff then let val acc = - case eyAxis of - ON_GROUND => EnemyPatch.W_Y_AXIS (JUMPING 0) :: acc - | FALLING => EnemyPatch.W_Y_AXIS (JUMPING 0) :: acc - | _ => acc + if standingOnArea (enemy, platformTree) then + EnemyPatch.W_Y_AXIS (JUMPING 0) :: acc + else + acc in EnemyPatch.W_X_AXIS MOVE_RIGHT :: acc end @@ -331,12 +331,19 @@ struct JUMPING amt => amt | _ => 0 val apexY = ey - (Constants.jumpLimit - jumpAmt) - val yDiff = apexY - platY + val yDiff = platY - apexY in if yDiff >= xDiff then (* can reach if we jump and move right *) - EnemyPatch.W_Y_AXIS (JUMPING 0) :: EnemyPatch.W_X_AXIS - MOVE_RIGHT :: acc + let + val acc = + if standingOnArea (enemy, platformTree) then + EnemyPatch.W_Y_AXIS (JUMPING 0) :: acc + else + acc + in + EnemyPatch.W_X_AXIS MOVE_RIGHT :: acc + end else (* cannot reach yet so move right until we can *) EnemyPatch.W_X_AXIS MOVE_RIGHT :: acc diff --git a/fcore/game-type.sml b/fcore/game-type.sml index 2ae646a..6cb07e8 100644 --- a/fcore/game-type.sml +++ b/fcore/game-type.sml @@ -174,9 +174,10 @@ struct val plat6 = {id = 6, x = 155, y = 710, width = 199} val plat7 = {id = 7, x = 301, y = 855, width = 99} val plat8 = {id = 8, x = 970, y = 815, width = 303} - val plat9 = {id = 9, x = 970, y = 655, width = 303} + val plat9 = {id = 9, x = 959, y = 705, width = 303} + val plat10 = {id = 10, x = 970, y = 759, width = 303} val platforms = Vector.fromList - [plat1, plat2, plat3, plat4, plat5, plat6, plat7, plat8, plat9] + [plat1, plat2, plat3, plat4, plat5, plat6, plat7, plat8, plat9, plat10] val platformTree = Platform.generateTree platforms val enemy1 =