Skip to content

Commit

Permalink
Make changes suggested by @ricochet1k
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswestman committed May 18, 2017
1 parent 66994f0 commit 3caeb09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
16 changes: 7 additions & 9 deletions src/scripts/actions.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import {SQUARE_SIZE, TWEEN_DURATION, S} from './const';
import {tween, tweenRotation, interp} from './tween';

export function actionLine(room, action, from, to, color) {
export function actionLine(room, action, from, to, color = 0xffff00) {
let g = new PIXI.Graphics();
room.g.addChild(g);

color = color || 0xffff00;

const fx = (from.x + 0.5) * SQUARE_SIZE;
const fy = (from.y + 0.5) * SQUARE_SIZE;
const tx = (to.x + 0.5) * SQUARE_SIZE;
Expand Down Expand Up @@ -49,13 +47,16 @@ export function bump(g, gRot, obj, a) {
});
}

export function flash(container, color) {
export function flash(container, color = 0xffff00) {
let g = new PIXI.Graphics();
g.position.set(S(5), S(5));
g.pivot.set(S(5), S(5));
container.addChild(g);

color = color || 0xffff00;
g.clear();
g.beginFill(color);
g.drawCircle(S(5), S(5), S(5));
g.endFill();

tween(TWEEN_DURATION, {}, v => {
if (v === 1) {
Expand All @@ -69,10 +70,7 @@ export function flash(container, color) {
v = (1 - v);
}

g.clear();
g.beginFill(color, v);
g.drawCircle(S(5), S(5), S(5));
g.endFill();
g.alpha = v;
});
}

Expand Down
10 changes: 3 additions & 7 deletions src/scripts/skins/original/creep.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export class CreepSkin {
break;

case 'say':
if(a) {
say(this.g, a.message);
}
break;

case 'repair':
Expand Down Expand Up @@ -65,13 +68,6 @@ export class CreepSkin {
}
}

if(obj.actionLog && "say" in obj.actionLog) {
obj.saying = obj.actionLog.say;
}
if(obj.saying) {
say(this.g, obj.saying.message);
}

g.clear();
g.beginFill(0x222222);
g.drawCircle(S(5), S(5), S(5));
Expand Down

0 comments on commit 3caeb09

Please sign in to comment.