add 'facing' field to player projectiles, so it is known which direction projectile should travel in

This commit is contained in:
2025-01-08 20:26:53 +00:00
parent bd946bf635
commit a2dc00704c
2 changed files with 4 additions and 4 deletions

View File

@@ -27,7 +27,7 @@ sig
type defeated_enemies = {angle: int}
type player_projectile = {x: int, y: int}
type player_projectile = {x: int, y: int, facing: facing}
type player =
{ yAxis: player_y_axis
@@ -106,7 +106,7 @@ struct
type defeated_enemies = {angle: int}
type player_projectile = {x: int, y: int}
type player_projectile = {x: int, y: int, facing: facing}
type player =
{ yAxis: player_y_axis

View File

@@ -523,7 +523,7 @@ struct
fun degreesToRadians degrees = Real32.fromInt degrees * defeatedPi
fun defeatedEnemiesToProjectiles
(pos, defeteadEnemies, player as {x, y, ...}, acc) =
(pos, defeteadEnemies, player as {x, y, facing, ...}, acc) =
if pos = Vector.length defeteadEnemies then
Vector.fromList acc
else
@@ -541,7 +541,7 @@ struct
val x = Real32.toInt IEEEReal.TO_NEAREST x
val y = Real32.toInt IEEEReal.TO_NEAREST y
val acc = {x = x, y = y} :: acc
val acc = {x = x, y = y, facing = facing} :: acc
in
defeatedEnemiesToProjectiles (pos + 1, defeteadEnemies, player, acc)
end