different colours for different enemies so they are easier to differentiate

This commit is contained in:
2025-02-15 12:18:08 +00:00
parent 491ad11c4c
commit 190f11d7ef
3 changed files with 17 additions and 6 deletions

View File

@@ -22,6 +22,9 @@ sig
} }
type falling_enemy = {x: int, y: int, variant: variant} type falling_enemy = {x: int, y: int, variant: variant}
datatype shoot_x_axis = SHOOT_LEFT | SHOOT_RIGHT | NO_SHOOT_X
datatype shoot_y_axis = SHOOT_UP | SHOOT_DOWN | NO_SHOOT_Y
end end
structure EnemyType: ENEMY_TYPE = structure EnemyType: ENEMY_TYPE =
@@ -48,4 +51,7 @@ struct
} }
type falling_enemy = {x: int, y: int, variant: variant} type falling_enemy = {x: int, y: int, variant: variant}
datatype shoot_x_axis = SHOOT_LEFT | SHOOT_RIGHT | NO_SHOOT_X
datatype shoot_y_axis = SHOOT_UP | SHOOT_DOWN | NO_SHOOT_Y
end end

View File

@@ -76,9 +76,16 @@ struct
fun helpGetDrawVec (enemy: EnemyType.enemy, width, height) = fun helpGetDrawVec (enemy: EnemyType.enemy, width, height) =
let let
val {x, y, ...} = enemy val {x, y, variant, ...} = enemy
val wratio = width / Constants.worldWidthReal val wratio = width / Constants.worldWidthReal
val hratio = height / Constants.worldHeightReal val hratio = height / Constants.worldHeightReal
open EnemyType
val (r, g, b) =
case variant of
PATROL_SLIME => (0.5, 0.5, 1.0)
| FOLLOW_SLIME => (1.0, 0.5, 0.5)
| STRAIGHT_BAT => (0.55, 0.55, 0.55)
in in
if wratio < hratio then if wratio < hratio then
let let
@@ -93,8 +100,7 @@ struct
val realSize = Constants.enemySizeReal * wratio val realSize = Constants.enemySizeReal * wratio
in in
Block.lerp Block.lerp (x, y, realSize, realSize, width, height, r, g, b)
(x, y, realSize, realSize, width, height, 0.5, 0.5, 1.0)
end end
else else
let let
@@ -109,8 +115,7 @@ struct
val realSize = Constants.enemySizeReal * hratio val realSize = Constants.enemySizeReal * hratio
in in
Block.lerp Block.lerp (x, y, realSize, realSize, width, height, r, g, b)
(x, y, realSize, realSize, width, height, 0.5, 0.5, 1.0)
end end
end end

View File

@@ -102,7 +102,7 @@ struct
, health = 1 , health = 1
, xAxis = EntityType.MOVE_RIGHT , xAxis = EntityType.MOVE_RIGHT
, yAxis = EntityType.FALLING , yAxis = EntityType.FALLING
, variant = EnemyType.PATROL_SLIME , variant = EnemyType.FOLLOW_SLIME
, batDirY = EnemyType.UP , batDirY = EnemyType.UP
, platID = ~1 , platID = ~1
, nextPlatID = ~1 , nextPlatID = ~1