done adding LevelType.level_type as a field of GameType.game_type, and having main loop go through GameUpdate.game_type -> LevelUpdate.update

This commit is contained in:
2025-02-18 13:48:17 +00:00
parent afe878c05d
commit 6b4b637624
7 changed files with 72 additions and 46 deletions

View File

@@ -9,10 +9,9 @@ sig
, enemies: EnemyMap.t
, graph: PlatSet.elem vector vector
, fallingEnemies: FallingEnemyMap.t
, userKeys: CoreKey.user_key
}
val initial: CoreKey.user_key -> level_type
val initial: level_type
end
structure LevelType :> LEVEL_TYPE =
@@ -26,7 +25,6 @@ struct
, enemies: EnemyMap.t
, graph: PlatSet.elem vector vector
, fallingEnemies: FallingEnemyMap.t
, userKeys: CoreKey.user_key
}
fun enemyMapFromList (hd :: tl, map) =
@@ -35,7 +33,7 @@ struct
end
| enemyMapFromList ([], map) = map
fun initial userKeys =
val initial =
let
val player =
{ yAxis = EntityType.JUMPING 0
@@ -142,7 +140,6 @@ struct
, enemies = enemies
, graph = graph
, fallingEnemies = FallingEnemyMap.empty
, userKeys = userKeys
}
end
end

View File

@@ -11,7 +11,6 @@ struct
, enemies
, graph
, fallingEnemies
, userKeys
} = game
val player = Player.runPhysicsAndInput (game, input)
@@ -40,7 +39,6 @@ struct
, enemies = enemies
, graph = graph
, fallingEnemies = fallingEnemies
, userKeys = userKeys
}
end
end

View File

@@ -501,10 +501,7 @@ struct
case attacked of
NOT_ATTACKED => (1.0, 1.0, 1.0)
| ATTACKED amt =>
if amt mod 5 = 0 then
(1.0, 1.0, 1.0)
else
(1.0, 0.75, 0.75)
if amt mod 5 = 0 then (1.0, 1.0, 1.0) else (1.0, 0.75, 0.75)
in
PlayerSprite.lerp (x, y, realWidth, realHeight, width, height, r, g, b)
end