begin adding variant for STRAIGHT_BAT enemy

This commit is contained in:
2025-02-11 18:05:44 +00:00
parent 534852c8bf
commit 3202c67f47
4 changed files with 96 additions and 57 deletions

View File

@@ -528,7 +528,7 @@ struct
, enemyList
, fallingList
)
| FOLLOW_SIME =>
| FOLLOW_SLIME =>
updateFollowState
( player
, enemy

View File

@@ -25,7 +25,8 @@ struct
| W_PLAT_ID of int
| W_NEXT_PLAT_ID of int
fun mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID) =
fun mkEnemy
(id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID, batRest) =
{ id = id
, health = health
, x = x
@@ -35,27 +36,106 @@ struct
, variant = variant
, platID = platID
, nextPlatID = nextPlatID
, batRest = batRest
}
fun withPatch (enemy, patch) =
let
val {id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID} = enemy
val {id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID, batRest} =
enemy
in
case patch of
W_HEALTH health =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
mkEnemy
( id
, health
, x
, y
, xAxis
, yAxis
, variant
, platID
, nextPlatID
, batRest
)
| W_X x =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
mkEnemy
( id
, health
, x
, y
, xAxis
, yAxis
, variant
, platID
, nextPlatID
, batRest
)
| W_X_AXIS xAxis =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
mkEnemy
( id
, health
, x
, y
, xAxis
, yAxis
, variant
, platID
, nextPlatID
, batRest
)
| W_Y y =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
mkEnemy
( id
, health
, x
, y
, xAxis
, yAxis
, variant
, platID
, nextPlatID
, batRest
)
| W_Y_AXIS yAxis =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
mkEnemy
( id
, health
, x
, y
, xAxis
, yAxis
, variant
, platID
, nextPlatID
, batRest
)
| W_PLAT_ID platID =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
mkEnemy
( id
, health
, x
, y
, xAxis
, yAxis
, variant
, platID
, nextPlatID
, batRest
)
| W_NEXT_PLAT_ID nextPlatID =>
mkEnemy (id, health, x, y, xAxis, yAxis, variant, platID, nextPlatID)
mkEnemy
( id
, health
, x
, y
, xAxis
, yAxis
, variant
, platID
, nextPlatID
, batRest
)
end
fun withPatches (enemy, lst) =

View File

@@ -1,7 +1,7 @@
signature ENEMY_VARIANTS =
sig
datatype t = PATROL_SLIME | FOLLOW_SLIME
datatype t = PATROL_SLIME | FOLLOW_SLIME | STRAIGHT_BAT
end
structure EnemyVariants: ENEMY_VARIANTS =
struct datatype t = PATROL_SLIME | FOLLOW_SLIME end
struct datatype t = PATROL_SLIME | FOLLOW_SLIME | STRAIGHT_BAT end

View File

@@ -56,6 +56,7 @@ sig
, variant: EnemyVariants.t
, platID: int
, nextPlatID: int
, batRest: int
}
type falling_enemy = {x: int, y: int, variant: EnemyVariants.t}
@@ -133,6 +134,7 @@ struct
, variant: EnemyVariants.t
, platID: int
, nextPlatID: int
, batRest: int
}
type falling_enemy = {x: int, y: int, variant: EnemyVariants.t}
@@ -220,52 +222,9 @@ struct
, variant = EnemyVariants.FOLLOW_SLIME
, platID = ~1
, nextPlatID = ~1
, batRest = 0
}
val enemy2 =
{ id = 2
, x = 777
, y = 333
, health = 1
, xAxis = MOVE_LEFT
, yAxis = FALLING
, variant = EnemyVariants.FOLLOW_SLIME
, platID = ~1
, nextPlatID = ~1
}
val enemy3 =
{ id = 3
, x = 555
, y = 135
, health = 1
, xAxis = MOVE_RIGHT
, yAxis = FALLING
, variant = EnemyVariants.FOLLOW_SLIME
, platID = ~1
, nextPlatID = ~1
}
val enemy4 =
{ id = 4
, x = 555
, y = 555
, health = 1
, xAxis = MOVE_RIGHT
, yAxis = FALLING
, variant = EnemyVariants.FOLLOW_SLIME
, platID = ~1
, nextPlatID = ~1
}
val enemy5 =
{ id = 5
, x = 199
, y = 333
, health = 1
, xAxis = MOVE_RIGHT
, yAxis = FALLING
, variant = EnemyVariants.FOLLOW_SLIME
, platID = ~1
, nextPlatID = ~1
}
val enemies = Vector.fromList [enemy1, enemy2, enemy3, enemy4, enemy5]
val enemies = Vector.fromList [enemy1]
val graph = Graph.fromPlatforms (platforms, platformTree)
in
{ player = player