restore working collision detection code to player's attack

This commit is contained in:
2025-08-29 10:14:28 +01:00
parent 22d43dc0c1
commit 1d1fed35cf
3 changed files with 62 additions and 54 deletions

View File

@@ -158,7 +158,7 @@ struct
(* adding playerWidth to x so that projectile starts from
* the rightmost pixel of the player *)
val projX = x + Constants.playerWidth
val projY = y + (Constants.playerHeight div 3)
val projY = y + Constants.projectileOffsetY
val projX = (Real32.fromInt projX + xOffset) * ratio
val projY = (Real32.fromInt projY + yOffset) * ratio
@@ -173,12 +173,10 @@ struct
val playerVec = PlayerAttackStandLeft.lerp
(rx, ry, 3.0, windowWidth, windowHeight)
(* subtracting playerHeight from x because projectile
* is the same size as the playerHeight, and it looks like
* the projectile starts from player's leftmost side this way.
* *)
val projX = x - Constants.playerHeight
val projY = y + (Constants.playerHeight div 3)
(* subtracting projectileWidth from x it looks like
* the projectile starts from player's leftmost side this way. *)
val projX = x - Constants.projectileWidth
val projY = y + Constants.projectileOffsetY
val projX = (Real32.fromInt projX + xOffset) * ratio
val projY = (Real32.fromInt projY + yOffset) * ratio