From 190f11d7ef655bfa3314e1334354eaf5228a5158 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sat, 15 Feb 2025 12:18:08 +0000 Subject: [PATCH] different colours for different enemies so they are easier to differentiate --- fcore/enemy/enemy-type.sml | 6 ++++++ fcore/enemy/enemy.sml | 15 ++++++++++----- fcore/game-type.sml | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/fcore/enemy/enemy-type.sml b/fcore/enemy/enemy-type.sml index 846f7fb..e28cc8e 100644 --- a/fcore/enemy/enemy-type.sml +++ b/fcore/enemy/enemy-type.sml @@ -22,6 +22,9 @@ sig } 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 structure EnemyType: ENEMY_TYPE = @@ -48,4 +51,7 @@ struct } 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 diff --git a/fcore/enemy/enemy.sml b/fcore/enemy/enemy.sml index 130d243..3976b4b 100644 --- a/fcore/enemy/enemy.sml +++ b/fcore/enemy/enemy.sml @@ -76,9 +76,16 @@ struct fun helpGetDrawVec (enemy: EnemyType.enemy, width, height) = let - val {x, y, ...} = enemy + val {x, y, variant, ...} = enemy val wratio = width / Constants.worldWidthReal 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 if wratio < hratio then let @@ -93,8 +100,7 @@ struct val realSize = Constants.enemySizeReal * wratio in - Block.lerp - (x, y, realSize, realSize, width, height, 0.5, 0.5, 1.0) + Block.lerp (x, y, realSize, realSize, width, height, r, g, b) end else let @@ -109,8 +115,7 @@ struct val realSize = Constants.enemySizeReal * hratio in - Block.lerp - (x, y, realSize, realSize, width, height, 0.5, 0.5, 1.0) + Block.lerp (x, y, realSize, realSize, width, height, r, g, b) end end diff --git a/fcore/game-type.sml b/fcore/game-type.sml index 1663886..3a243cb 100644 --- a/fcore/game-type.sml +++ b/fcore/game-type.sml @@ -102,7 +102,7 @@ struct , health = 1 , xAxis = EntityType.MOVE_RIGHT , yAxis = EntityType.FALLING - , variant = EnemyType.PATROL_SLIME + , variant = EnemyType.FOLLOW_SLIME , batDirY = EnemyType.UP , platID = ~1 , nextPlatID = ~1