add 'facing' field to player projectiles, so it is known which direction projectile should travel in
This commit is contained in:
@@ -27,7 +27,7 @@ sig
|
|||||||
|
|
||||||
type defeated_enemies = {angle: int}
|
type defeated_enemies = {angle: int}
|
||||||
|
|
||||||
type player_projectile = {x: int, y: int}
|
type player_projectile = {x: int, y: int, facing: facing}
|
||||||
|
|
||||||
type player =
|
type player =
|
||||||
{ yAxis: player_y_axis
|
{ yAxis: player_y_axis
|
||||||
@@ -106,7 +106,7 @@ struct
|
|||||||
|
|
||||||
type defeated_enemies = {angle: int}
|
type defeated_enemies = {angle: int}
|
||||||
|
|
||||||
type player_projectile = {x: int, y: int}
|
type player_projectile = {x: int, y: int, facing: facing}
|
||||||
|
|
||||||
type player =
|
type player =
|
||||||
{ yAxis: player_y_axis
|
{ yAxis: player_y_axis
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ struct
|
|||||||
fun degreesToRadians degrees = Real32.fromInt degrees * defeatedPi
|
fun degreesToRadians degrees = Real32.fromInt degrees * defeatedPi
|
||||||
|
|
||||||
fun defeatedEnemiesToProjectiles
|
fun defeatedEnemiesToProjectiles
|
||||||
(pos, defeteadEnemies, player as {x, y, ...}, acc) =
|
(pos, defeteadEnemies, player as {x, y, facing, ...}, acc) =
|
||||||
if pos = Vector.length defeteadEnemies then
|
if pos = Vector.length defeteadEnemies then
|
||||||
Vector.fromList acc
|
Vector.fromList acc
|
||||||
else
|
else
|
||||||
@@ -541,7 +541,7 @@ struct
|
|||||||
val x = Real32.toInt IEEEReal.TO_NEAREST x
|
val x = Real32.toInt IEEEReal.TO_NEAREST x
|
||||||
val y = Real32.toInt IEEEReal.TO_NEAREST y
|
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
|
in
|
||||||
defeatedEnemiesToProjectiles (pos + 1, defeteadEnemies, player, acc)
|
defeatedEnemiesToProjectiles (pos + 1, defeteadEnemies, player, acc)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user