draw player differently when they are attacking (player is just different colour for now; placeholder asset to change for later)

This commit is contained in:
2024-12-22 21:08:59 +00:00
parent 400b971c7b
commit d8b70dfccb

View File

@@ -597,18 +597,30 @@ struct
end end
(* block is placeholder asset *) (* block is placeholder asset *)
fun helpGetDrawVec (x, y, size, width, height, attacked) = fun helpGetDrawVec (x, y, size, width, height, attacked, mainAttack) =
case attacked of case mainAttack of
NOT_ATTACKED => MAIN_NOT_ATTACKING =>
Block.lerp (x, y, size, size, width, height, 0.5, 0.5, 0.5) (case attacked of
| ATTACKED amt => NOT_ATTACKED =>
if amt mod 5 = 0 then Block.lerp (x, y, size, size, width, height, 0.5, 0.5, 0.5)
Block.lerp (x, y, size, size, width, height, 0.9, 0.9, 0.9) | ATTACKED amt =>
else if amt mod 5 = 0 then
Block.lerp (x, y, size, size, width, height, 0.5, 0.5, 0.5) Block.lerp (x, y, size, size, width, height, 0.9, 0.9, 0.9)
else
Block.lerp (x, y, size, size, width, height, 0.5, 0.5, 0.5))
| MAIN_ATTACKING _ =>
(case attacked of
NOT_ATTACKED =>
Block.lerp (x, y, size, size, width, height, 1.0, 0.5, 0.5)
| ATTACKED amt =>
if amt mod 5 = 0 then
Block.lerp (x, y, size, size, width, height, 1.0, 0.9, 0.9)
else
Block.lerp (x, y, size, size, width, height, 1.0, 0.5, 0.5))
fun getDrawVec ({x, y, attacked, ...}: player, width, height) = fun getDrawVec (player: player, width, height) =
let let
val {x, y, attacked, mainAttack, ...} = player
val wratio = width / 1920.0 val wratio = width / 1920.0
val hratio = height / 1080.0 val hratio = height / 1080.0
in in
@@ -625,7 +637,7 @@ struct
val realSize = realSize * wratio val realSize = realSize * wratio
in in
helpGetDrawVec (x, y, realSize, width, height, attacked) helpGetDrawVec (x, y, realSize, width, height, attacked, mainAttack)
end end
else else
let let
@@ -640,7 +652,7 @@ struct
val realSize = realSize * hratio val realSize = realSize * hratio
in in
helpGetDrawVec (x, y, realSize, width, height, attacked) helpGetDrawVec (x, y, realSize, width, height, attacked, mainAttack)
end end
end end
end end