From d8b70dfccb8bb09d344b2495df64656fb4e462cf Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sun, 22 Dec 2024 21:08:59 +0000 Subject: [PATCH] draw player differently when they are attacking (player is just different colour for now; placeholder asset to change for later) --- fcore/player.sml | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/fcore/player.sml b/fcore/player.sml index 010af57..5fde1ab 100644 --- a/fcore/player.sml +++ b/fcore/player.sml @@ -597,18 +597,30 @@ struct end (* block is placeholder asset *) - fun helpGetDrawVec (x, y, size, width, height, attacked) = - case attacked of - NOT_ATTACKED => - Block.lerp (x, y, size, size, width, height, 0.5, 0.5, 0.5) - | ATTACKED amt => - if amt mod 5 = 0 then - 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) + fun helpGetDrawVec (x, y, size, width, height, attacked, mainAttack) = + case mainAttack of + MAIN_NOT_ATTACKING => + (case attacked of + NOT_ATTACKED => + Block.lerp (x, y, size, size, width, height, 0.5, 0.5, 0.5) + | ATTACKED amt => + if amt mod 5 = 0 then + 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 + val {x, y, attacked, mainAttack, ...} = player val wratio = width / 1920.0 val hratio = height / 1080.0 in @@ -625,7 +637,7 @@ struct val realSize = realSize * wratio in - helpGetDrawVec (x, y, realSize, width, height, attacked) + helpGetDrawVec (x, y, realSize, width, height, attacked, mainAttack) end else let @@ -640,7 +652,7 @@ struct val realSize = realSize * hratio in - helpGetDrawVec (x, y, realSize, width, height, attacked) + helpGetDrawVec (x, y, realSize, width, height, attacked, mainAttack) end end end