add fields to enemy which are relevant to bat's state
This commit is contained in:
@@ -30,7 +30,7 @@ struct
|
|||||||
val enemySize = 35
|
val enemySize = 35
|
||||||
val enemySizeReal: Real32.real = 35.0
|
val enemySizeReal: Real32.real = 35.0
|
||||||
val moveEnemyBy = 3
|
val moveEnemyBy = 3
|
||||||
val batRestLimit = 75
|
val batRestLimit = 55
|
||||||
|
|
||||||
val moveProjectileBy = 11
|
val moveProjectileBy = 11
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ sig
|
|||||||
| W_PLAT_ID of int
|
| W_PLAT_ID of int
|
||||||
| W_NEXT_PLAT_ID of int
|
| W_NEXT_PLAT_ID of int
|
||||||
| W_BAT_REST of int
|
| W_BAT_REST of int
|
||||||
|
| W_BAT_MAX_Y of int
|
||||||
|
| W_BAT_MIN_Y of int
|
||||||
|
| W_BAT_DIR_Y of GameType.bat_dir_y
|
||||||
|
|
||||||
val withPatch: GameType.enemy * enemy_patch -> GameType.enemy
|
val withPatch: GameType.enemy * enemy_patch -> GameType.enemy
|
||||||
|
|
||||||
@@ -26,9 +29,25 @@ struct
|
|||||||
| W_PLAT_ID of int
|
| W_PLAT_ID of int
|
||||||
| W_NEXT_PLAT_ID of int
|
| W_NEXT_PLAT_ID of int
|
||||||
| W_BAT_REST of int
|
| W_BAT_REST of int
|
||||||
|
| W_BAT_MAX_Y of int
|
||||||
|
| W_BAT_MIN_Y of int
|
||||||
|
| W_BAT_DIR_Y of GameType.bat_dir_y
|
||||||
|
|
||||||
fun mkEnemy
|
fun mkEnemy
|
||||||
(id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID, batRest) =
|
( id
|
||||||
|
, health
|
||||||
|
, x
|
||||||
|
, y
|
||||||
|
, xAxis
|
||||||
|
, yAxis
|
||||||
|
, variant
|
||||||
|
, platID
|
||||||
|
, nextPlatID
|
||||||
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
|
) =
|
||||||
{ id = id
|
{ id = id
|
||||||
, health = health
|
, health = health
|
||||||
, x = x
|
, x = x
|
||||||
@@ -39,12 +58,28 @@ struct
|
|||||||
, platID = platID
|
, platID = platID
|
||||||
, nextPlatID = nextPlatID
|
, nextPlatID = nextPlatID
|
||||||
, batRest = batRest
|
, batRest = batRest
|
||||||
|
, batDirY = batDirY
|
||||||
|
, batMaxY = batMaxY
|
||||||
|
, batMinY = batMinY
|
||||||
}
|
}
|
||||||
|
|
||||||
fun withPatch (enemy, patch) =
|
fun withPatch (enemy, patch) =
|
||||||
let
|
let
|
||||||
val {id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID, batRest} =
|
val
|
||||||
enemy
|
{ id
|
||||||
|
, health
|
||||||
|
, x
|
||||||
|
, y
|
||||||
|
, xAxis
|
||||||
|
, yAxis
|
||||||
|
, variant
|
||||||
|
, platID
|
||||||
|
, nextPlatID
|
||||||
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
|
} = enemy
|
||||||
in
|
in
|
||||||
case patch of
|
case patch of
|
||||||
W_HEALTH health =>
|
W_HEALTH health =>
|
||||||
@@ -59,6 +94,9 @@ struct
|
|||||||
, platID
|
, platID
|
||||||
, nextPlatID
|
, nextPlatID
|
||||||
, batRest
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
)
|
)
|
||||||
| W_X x =>
|
| W_X x =>
|
||||||
mkEnemy
|
mkEnemy
|
||||||
@@ -72,6 +110,9 @@ struct
|
|||||||
, platID
|
, platID
|
||||||
, nextPlatID
|
, nextPlatID
|
||||||
, batRest
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
)
|
)
|
||||||
| W_X_AXIS xAxis =>
|
| W_X_AXIS xAxis =>
|
||||||
mkEnemy
|
mkEnemy
|
||||||
@@ -85,6 +126,9 @@ struct
|
|||||||
, platID
|
, platID
|
||||||
, nextPlatID
|
, nextPlatID
|
||||||
, batRest
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
)
|
)
|
||||||
| W_Y y =>
|
| W_Y y =>
|
||||||
mkEnemy
|
mkEnemy
|
||||||
@@ -98,6 +142,9 @@ struct
|
|||||||
, platID
|
, platID
|
||||||
, nextPlatID
|
, nextPlatID
|
||||||
, batRest
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
)
|
)
|
||||||
| W_Y_AXIS yAxis =>
|
| W_Y_AXIS yAxis =>
|
||||||
mkEnemy
|
mkEnemy
|
||||||
@@ -111,6 +158,9 @@ struct
|
|||||||
, platID
|
, platID
|
||||||
, nextPlatID
|
, nextPlatID
|
||||||
, batRest
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
)
|
)
|
||||||
| W_PLAT_ID platID =>
|
| W_PLAT_ID platID =>
|
||||||
mkEnemy
|
mkEnemy
|
||||||
@@ -124,6 +174,9 @@ struct
|
|||||||
, platID
|
, platID
|
||||||
, nextPlatID
|
, nextPlatID
|
||||||
, batRest
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
)
|
)
|
||||||
| W_NEXT_PLAT_ID nextPlatID =>
|
| W_NEXT_PLAT_ID nextPlatID =>
|
||||||
mkEnemy
|
mkEnemy
|
||||||
@@ -137,6 +190,9 @@ struct
|
|||||||
, platID
|
, platID
|
||||||
, nextPlatID
|
, nextPlatID
|
||||||
, batRest
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
)
|
)
|
||||||
| W_BAT_REST batRest =>
|
| W_BAT_REST batRest =>
|
||||||
mkEnemy
|
mkEnemy
|
||||||
@@ -150,6 +206,57 @@ struct
|
|||||||
, platID
|
, platID
|
||||||
, nextPlatID
|
, nextPlatID
|
||||||
, batRest
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
|
)
|
||||||
|
| W_BAT_MAX_Y batMaxY =>
|
||||||
|
mkEnemy
|
||||||
|
( id
|
||||||
|
, health
|
||||||
|
, x
|
||||||
|
, y
|
||||||
|
, xAxis
|
||||||
|
, yAxis
|
||||||
|
, variant
|
||||||
|
, platID
|
||||||
|
, nextPlatID
|
||||||
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
|
)
|
||||||
|
| W_BAT_MIN_Y batMinY =>
|
||||||
|
mkEnemy
|
||||||
|
( id
|
||||||
|
, health
|
||||||
|
, x
|
||||||
|
, y
|
||||||
|
, xAxis
|
||||||
|
, yAxis
|
||||||
|
, variant
|
||||||
|
, platID
|
||||||
|
, nextPlatID
|
||||||
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
|
)
|
||||||
|
| W_BAT_DIR_Y batDirY =>
|
||||||
|
mkEnemy
|
||||||
|
( id
|
||||||
|
, health
|
||||||
|
, x
|
||||||
|
, y
|
||||||
|
, xAxis
|
||||||
|
, yAxis
|
||||||
|
, variant
|
||||||
|
, platID
|
||||||
|
, nextPlatID
|
||||||
|
, batRest
|
||||||
|
, batDirY
|
||||||
|
, batMaxY
|
||||||
|
, batMinY
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ sig
|
|||||||
, platID: int
|
, platID: int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
datatype bat_dir_y = UP | DOWN
|
||||||
|
|
||||||
type enemy =
|
type enemy =
|
||||||
{ id: int
|
{ id: int
|
||||||
, health: int
|
, health: int
|
||||||
@@ -57,6 +59,9 @@ sig
|
|||||||
, platID: int
|
, platID: int
|
||||||
, nextPlatID: int
|
, nextPlatID: int
|
||||||
, batRest: int
|
, batRest: int
|
||||||
|
, batDirY: bat_dir_y
|
||||||
|
, batMaxY: int
|
||||||
|
, batMinY: int
|
||||||
}
|
}
|
||||||
|
|
||||||
type falling_enemy = {x: int, y: int, variant: EnemyVariants.t}
|
type falling_enemy = {x: int, y: int, variant: EnemyVariants.t}
|
||||||
@@ -124,6 +129,8 @@ struct
|
|||||||
, platID: int
|
, platID: int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
datatype bat_dir_y = UP | DOWN
|
||||||
|
|
||||||
type enemy =
|
type enemy =
|
||||||
{ id: int
|
{ id: int
|
||||||
, health: int
|
, health: int
|
||||||
@@ -135,6 +142,9 @@ struct
|
|||||||
, platID: int
|
, platID: int
|
||||||
, nextPlatID: int
|
, nextPlatID: int
|
||||||
, batRest: int
|
, batRest: int
|
||||||
|
, batDirY: bat_dir_y
|
||||||
|
, batMaxY: int
|
||||||
|
, batMinY: int
|
||||||
}
|
}
|
||||||
|
|
||||||
type falling_enemy = {x: int, y: int, variant: EnemyVariants.t}
|
type falling_enemy = {x: int, y: int, variant: EnemyVariants.t}
|
||||||
@@ -223,6 +233,9 @@ struct
|
|||||||
, platID = ~1
|
, platID = ~1
|
||||||
, nextPlatID = ~1
|
, nextPlatID = ~1
|
||||||
, batRest = 0
|
, batRest = 0
|
||||||
|
, batDirY = UP
|
||||||
|
, batMaxY = 635
|
||||||
|
, batMinY = 475
|
||||||
}
|
}
|
||||||
val enemies = Vector.fromList [enemy1]
|
val enemies = Vector.fromList [enemy1]
|
||||||
val graph = Graph.fromPlatforms (platforms, platformTree)
|
val graph = Graph.fromPlatforms (platforms, platformTree)
|
||||||
|
|||||||
Reference in New Issue
Block a user