Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
Fix a bug that caused creeps with no CARRY parts not to render.

Fix a bug that prevented creep speech bubbles from showing

Add attack effect
  • Loading branch information
jameswestman committed Apr 20, 2017
1 parent 24af0cb commit 8d31717
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/scripts/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export function say(container, text) {
bubble.drawRoundedRect(0, 0, text.width, text.height, 3);
bubble.endFill();

bubble.position.set(S(5) - (text.width / 2), 0);
text.position.set(S(5) - (text.width / 2), 0);
bubble.position.set(S(5) - (text.width / 2), -S(5));
text.position.set(S(5) - (text.width / 2), -S(5));

container.addChild(bubble);
container.addChild(text);
Expand Down
24 changes: 16 additions & 8 deletions src/scripts/skins/original/creep.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export class CreepSkin {
bump(this.g, g, obj, a);
break;

case 'say':
break;

case 'repair':
case 'build':
case 'upgradeController':
Expand All @@ -54,13 +57,16 @@ export class CreepSkin {
actionLine(room, k, {x: obj.x, y: obj.y}, a, 0x0000FF);
break;

case 'attack':
bump(this.g, g, obj, a)

default:
console.log("actionLog", k, a, this);
}
}

if("say" in obj.actionLog) {
obj.saying = obj.actionLog.saying;
if(obj.actionLog && "say" in obj.actionLog) {
obj.saying = obj.actionLog.say;
}
if(obj.saying) {
say(this.g, obj.saying.message);
Expand Down Expand Up @@ -99,12 +105,14 @@ export class CreepSkin {
g.arc(m, m, pr-pw, +workAL, -workAL, true);
g.endFill();

g.lineStyle(0, 0, 0);
g.beginFill(0xffff00);
let e = S(2.5) * Math.sqrt(obj.energy / obj.energyCapacity);
if (e > 0) e = Math.max(1, e);
g.drawCircle(m, m, e);
g.endFill();
if(obj.carryCapacity) {
g.lineStyle(0, 0, 0);
g.beginFill(0xffff00);
let e = S(2.5) * Math.sqrt(obj.energy / obj.carryCapacity);
if (e > 0) e = Math.max(1, e);
g.drawCircle(m, m, e);
g.endFill();
}

tweenRotation(TWEEN_DURATION/2, g, this.creep.lastObj, obj);
}
Expand Down

0 comments on commit 8d31717

Please sign in to comment.