From e4516c0e4e3014925f41575d8009bf7afcb30824 Mon Sep 17 00:00:00 2001 From: Matt Peterson Date: Thu, 6 Apr 2017 12:00:34 -0400 Subject: [PATCH] Rendering tweaks --- src/scripts/objects/extension.js | 4 +++- src/scripts/objects/source.js | 4 +++- src/scripts/objects/spawn.js | 4 +++- src/scripts/skins/original/creep.js | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/scripts/objects/extension.js b/src/scripts/objects/extension.js index 1898fd9..f833800 100644 --- a/src/scripts/objects/extension.js +++ b/src/scripts/objects/extension.js @@ -19,7 +19,9 @@ export default class Extension extends GameObject { g.lineStyle(0, 0, 0); g.beginFill(0xffff00); - g.drawCircle(S(5), S(5), (S(4) - 2) * obj.energy / obj.energyCapacity); + let e = (S(4) - 2) * Math.sqrt(obj.energy / obj.energyCapacity); + if (e > 0) e = Math.max(1, e); + g.drawCircle(S(5), S(5), e); g.endFill(); } } diff --git a/src/scripts/objects/source.js b/src/scripts/objects/source.js index 5ee41ba..5c75a46 100644 --- a/src/scripts/objects/source.js +++ b/src/scripts/objects/source.js @@ -18,7 +18,9 @@ export default class Source extends GameObject { g.drawCircle(S(5), S(5), S(5)); g.beginFill(0xffff00); - g.drawCircle(S(5), S(5), S(5) * Math.ceil(obj.energy / obj.energyCapacity)); + let e = S(5) * Math.sqrt(obj.energy / obj.energyCapacity); + if (e > 0) e = Math.max(1, e); + g.drawCircle(S(5), S(5), e); g.endFill(); } } diff --git a/src/scripts/objects/spawn.js b/src/scripts/objects/spawn.js index a83ae1d..0e223c7 100644 --- a/src/scripts/objects/spawn.js +++ b/src/scripts/objects/spawn.js @@ -21,7 +21,9 @@ export default class Spawn extends GameObject { g.lineStyle(0, 0, 0); g.beginFill(0xffff00); - g.drawCircle(S(5), S(5), S(5) * obj.energy / obj.energyCapacity); + let e = (S(5) - 2) * Math.sqrt(obj.energy / obj.energyCapacity); + if (e > 0) e = Math.max(1, e); + g.drawCircle(S(5), S(5), e); g.endFill(); } } diff --git a/src/scripts/skins/original/creep.js b/src/scripts/skins/original/creep.js index 4d6418a..f5bb027 100644 --- a/src/scripts/skins/original/creep.js +++ b/src/scripts/skins/original/creep.js @@ -95,7 +95,7 @@ export class CreepSkin { g.lineStyle(0, 0, 0); g.beginFill(0xffff00); let e = S(2.5) * Math.sqrt(obj.energy / obj.energyCapacity); - if (obj.energy > 0) e = Math.max(1, e); + if (e > 0) e = Math.max(1, e); g.drawCircle(m, m, e); g.endFill();