refactor player and enemy records to have a platID field (representing the last platform that player or enemy stood on), and fix resulting compile errors
This commit is contained in:
@@ -6,6 +6,7 @@ sig
|
||||
| W_Y of int
|
||||
| W_X_AXIS of GameType.x_axis
|
||||
| W_Y_AXIS of GameType.y_axis
|
||||
| W_PLAT_ID of int
|
||||
|
||||
val withPatch: GameType.enemy * enemy_patch -> GameType.enemy
|
||||
|
||||
@@ -20,8 +21,9 @@ struct
|
||||
| W_Y of int
|
||||
| W_X_AXIS of GameType.x_axis
|
||||
| W_Y_AXIS of GameType.y_axis
|
||||
| W_PLAT_ID of int
|
||||
|
||||
fun mkEnemy (id, health, x, y, xAxis, yAxis, variant) =
|
||||
fun mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID) =
|
||||
{ id = id
|
||||
, health = health
|
||||
, x = x
|
||||
@@ -29,18 +31,24 @@ struct
|
||||
, xAxis = xAxis
|
||||
, yAxis = yAxis
|
||||
, variant = variant
|
||||
, platID = platID
|
||||
}
|
||||
|
||||
fun withPatch (enemy, patch) =
|
||||
let
|
||||
val {id, health, x, y, xAxis, yAxis, variant} = enemy
|
||||
val {id, health, x, y, xAxis, yAxis, variant, platID} = enemy
|
||||
in
|
||||
case patch of
|
||||
W_HEALTH health => mkEnemy (id, health, x, y, xAxis, yAxis, variant)
|
||||
| W_X x => mkEnemy (id, health, x, y, xAxis, yAxis, variant)
|
||||
| W_X_AXIS xAxis => mkEnemy (id, health, x, y, xAxis, yAxis, variant)
|
||||
| W_Y y => mkEnemy (id, health, x, y, xAxis, yAxis, variant)
|
||||
| W_Y_AXIS yAxis => mkEnemy (id, health, x, y, xAxis, yAxis, variant)
|
||||
W_HEALTH health =>
|
||||
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID)
|
||||
| W_X x => mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID)
|
||||
| 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)
|
||||
| W_Y_AXIS yAxis =>
|
||||
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID)
|
||||
| W_PLAT_ID platID =>
|
||||
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID)
|
||||
end
|
||||
|
||||
fun withPatches (enemy, lst) =
|
||||
|
||||
Reference in New Issue
Block a user