small improvement to player's sprite (and create subdirectory for player's sprites too, as I expect there will be quite a few)

This commit is contained in:
2025-02-22 06:02:28 +00:00
parent aa2936499d
commit f8ed79c81f
4 changed files with 328 additions and 7 deletions

View File

@@ -496,7 +496,7 @@ struct
(* block is placeholder asset *)
fun helpGetDrawVec
(x, y, realWidth, realHeight, width, height, attacked, mainAttack) =
(x, y, realWidth, realHeight, width, height, attacked, facing) =
let
val (r, g, b) =
case attacked of
@@ -504,12 +504,18 @@ struct
| ATTACKED amt =>
if amt mod 5 = 0 then (1.0, 1.0, 1.0) else (1.0, 0.75, 0.75)
in
PlayerSprite.lerp (x, y, realWidth, realHeight, width, height, r, g, b)
case facing of
FACING_RIGHT =>
PlayerStandingRight.lerp
(x, y, realWidth, realHeight, width, height, r, g, b)
| FACING_LEFT =>
PlayerStandingLeft.lerp
(x, y, realWidth, realHeight, width, height, r, g, b)
end
fun getDrawVec (player: player, width, height) =
let
val {x, y, attacked, mainAttack, ...} = player
val {x, y, attacked, facing, ...} = player
val wratio = width / Constants.worldWidthReal
val hratio = height / Constants.worldHeightReal
in
@@ -528,7 +534,7 @@ struct
val realHeight = Constants.playerHeightReal * wratio
in
helpGetDrawVec
(x, y, realWidth, realHeight, width, height, attacked, mainAttack)
(x, y, realWidth, realHeight, width, height, attacked, facing)
end
else
let
@@ -545,7 +551,7 @@ struct
val realHeight = Constants.playerHeightReal * hratio
in
helpGetDrawVec
(x, y, realWidth, realHeight, width, height, attacked, mainAttack)
(x, y, realWidth, realHeight, width, height, attacked, facing)
end
end