better path landing implemented, making sure enemy fully overlaps platform they are trying to reach, and enemy's jump is clearer (before, when enemy landed on platform, they went straight to the top of the platform, but now they jump a little over the platform which looks clearer)

This commit is contained in:
2025-01-26 13:23:20 +00:00
parent c25afb6f03
commit bb0cf6bd33
3 changed files with 84 additions and 14 deletions

View File

@@ -7,6 +7,7 @@ sig
| W_X_AXIS of GameType.x_axis
| W_Y_AXIS of GameType.y_axis
| W_PLAT_ID of int
| W_NEXT_PLAT_ID of int
val withPatch: GameType.enemy * enemy_patch -> GameType.enemy
@@ -22,8 +23,9 @@ struct
| W_X_AXIS of GameType.x_axis
| W_Y_AXIS of GameType.y_axis
| W_PLAT_ID of int
| W_NEXT_PLAT_ID of int
fun mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID) =
fun mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID) =
{ id = id
, health = health
, x = x
@@ -32,23 +34,26 @@ struct
, yAxis = yAxis
, variant = variant
, platID = platID
, nextPlatID = nextPlatID
}
fun withPatch (enemy, patch) =
let
val {id, health, x, y, xAxis, yAxis, variant, platID} = enemy
val {id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID} = enemy
in
case patch of
W_HEALTH health =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID)
| W_X x => mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID)
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
| W_X x => mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
| W_X_AXIS xAxis =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID)
| W_Y y => mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID)
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
| W_Y y => mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
| W_Y_AXIS yAxis =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID)
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
| W_PLAT_ID platID =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID)
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
| W_NEXT_PLAT_ID nextPlatID =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
end
fun withPatches (enemy, lst) =