From d74c9d86fff43d5a9cfab14fdc3cbac2d398e1f0 Mon Sep 17 00:00:00 2001 From: Fscked-In-The-Head Date: Tue, 17 Nov 2020 20:38:58 -0800 Subject: [PATCH] Change colours based on final roll result Changed text colour to grey while bouncing, changing to white on final bounce except for critical rolls. Critical hit is red text on black, critical miss is black text on red. --- apps/rpgdice/app.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/rpgdice/app.js b/apps/rpgdice/app.js index 2007d6ab0..be7b934e2 100755 --- a/apps/rpgdice/app.js +++ b/apps/rpgdice/app.js @@ -14,12 +14,18 @@ function getDie() { } function setColors(lastBounce) { - if (lastBounce) { - bgColor = 0xFFFF; + if (lastBounce && face == getDie()) { + bgColor = 0x0000; // Critical Hit + fgColor = 0xF800; + } else if (lastBounce && face == 1){ + bgColor = 0xF800; // Critical Miss fgColor = 0x0000; - } else { - bgColor = 0x0000 + } else if (lastBounce){ + bgColor = 0x0000; // Other Result fgColor = 0xFFFF; + } else { + bgColor = 0x0000; // Still Rolling + fgColor = 0x7BEF; } }