Indicate stolen identity in dialogues
authorMegaBrutal <code+git@megabrutal.com>
Sat, 15 Sep 2018 23:35:00 +0000 (01:35 +0200)
committerMegaBrutal <code+git@megabrutal.com>
Sat, 15 Sep 2018 23:35:00 +0000 (01:35 +0200)
The original name ("John") appears with strikethrough, next to the
name of the person whose ID card was taken.

modified:   wgj58.js

wgj58.js

index 645ec52..0726f07 100644 (file)
--- a/wgj58.js
+++ b/wgj58.js
@@ -159,6 +159,7 @@ class Player extends Phaser.Sprite {
        takeMe(npc) {
                this.loadTexture(npc.key);
                npc.kill();
+               this.disguise = npc;
        }
 }
 
@@ -541,6 +542,11 @@ class GameInterface extends Phaser.Group {
                this.text_talktitle = new Phaser.Text(game, this.back_talk.x, this.back_talk.y, null, style);
                this.text_talktitle.anchor.setTo(-0.2, -0.2);
                this.add(this.text_talktitle);
+               this.strikethrough_talktitle = new Phaser.Graphics(game, this.back_talk.x, this.back_talk.y);
+               this.strikethrough_talktitle.lineStyle(3, Phaser.Color.RED, 1);
+               this.strikethrough_talktitle.moveTo(20, 20);
+               this.strikethrough_talktitle.lineTo(75, 20);
+               this.add(this.strikethrough_talktitle);
                style = { align: 'left', fill: 'white', font: 'Ubuntu Mono', fontSize: 18, fontWeight: 'bold' };
                this.text_talk = new Phaser.Text(game, this.back_talk.x + 35, this.back_talk.y + 40, null, style);
                this.text_talk.wordWrap = true;
@@ -603,6 +609,7 @@ class GameInterface extends Phaser.Group {
                this.dialogue = null;
                this.back_talk.visible = false;
                this.text_talktitle.visible = false;
+               this.strikethrough_talktitle.visible = false;
                this.text_talk.visible = false;
        }
 
@@ -611,7 +618,14 @@ class GameInterface extends Phaser.Group {
                console.log(this.dialogue.actual());
                var actualdialogue = this.dialogue.actual();
                if (actualdialogue) {
-                       this.text_talktitle.text = actualdialogue.actor.shortname;
+                       if (actualdialogue.actor.disguise) {
+                               this.text_talktitle.text = actualdialogue.actor.shortname + " " + actualdialogue.actor.disguise.shortname;
+                               this.strikethrough_talktitle.visible = true;
+                       }
+                       else {
+                               this.text_talktitle.text = actualdialogue.actor.shortname;
+                               this.strikethrough_talktitle.visible = false;
+                       }
                        this.text_talk.text = actualdialogue.text;
                        this.dialogue.advance();
                }