add offset to projectile when player is attacking

This commit is contained in:
2025-08-29 01:29:51 +01:00
parent aaaa79cdc0
commit fc540fa8d2
2 changed files with 28 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ struct
val recoilLimit = 15
val attackedLimit = 55
val maxCharge = 60
val mainAttackLimit = 25
val mainAttackLimit = 24
(* constants for projectiles *)
val projectilePi: Real32.real = Real32.Math.pi / 180.0

View File

@@ -149,12 +149,33 @@ struct
fun helpGet (player: player, rx, ry, windowWidth, windowHeight) =
case #mainAttack player of
MAIN_ATTACKING amt =>
(case #facing player of
FACING_RIGHT =>
let
val playerVec = PlayerAttackStandLeft.lerp (rx, ry, 3.0, windowWidth, windowHeight)
val projectileVec = Vector.fromList []
val playerVec = PlayerAttackStandLeft.lerp
(rx, ry, 3.0, windowWidth, windowHeight)
val projY = ry + (Constants.playerHeightReal / 2.0)
val projX = rx + Constants.playerWidthReal
val func = Vector.sub (attackLeftProjectiles, amt)
val projectilesVec = func
(projX, projY, 3.0, windowWidth, windowHeight)
in
playerVec
Vector.concat [playerVec, projectilesVec]
end
| FACING_LEFT =>
let
val playerVec = PlayerAttackStandLeft.lerp
(rx, ry, 3.0, windowWidth, windowHeight)
val projY = ry + (Constants.playerHeightReal / 2.0)
val projX = rx - Constants.playerWidthReal
val func = Vector.sub (attackLeftProjectiles, amt)
val projectilesVec = func
(projX, projY, 3.0, windowWidth, windowHeight)
in
Vector.concat [playerVec, projectilesVec]
end)
| _ =>
case #attacked player of
NOT_ATTACKED =>