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 recoilLimit = 15
val attackedLimit = 55 val attackedLimit = 55
val maxCharge = 60 val maxCharge = 60
val mainAttackLimit = 25 val mainAttackLimit = 24
(* constants for projectiles *) (* constants for projectiles *)
val projectilePi: Real32.real = Real32.Math.pi / 180.0 val projectilePi: Real32.real = Real32.Math.pi / 180.0

View File

@@ -149,12 +149,33 @@ struct
fun helpGet (player: player, rx, ry, windowWidth, windowHeight) = fun helpGet (player: player, rx, ry, windowWidth, windowHeight) =
case #mainAttack player of case #mainAttack player of
MAIN_ATTACKING amt => MAIN_ATTACKING amt =>
let (case #facing player of
val playerVec = PlayerAttackStandLeft.lerp (rx, ry, 3.0, windowWidth, windowHeight) FACING_RIGHT =>
val projectileVec = Vector.fromList [] let
in val playerVec = PlayerAttackStandLeft.lerp
playerVec (rx, ry, 3.0, windowWidth, windowHeight)
end
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
| 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 case #attacked player of
NOT_ATTACKED => NOT_ATTACKED =>