Take ID actions now open doors
[wgj58.git] / wgj58.js
index 8885d24f3092fd3fbd9562f532c968cddae8070c..4f8ed78274bff09d54a83de4a56e301965ff00cc 100644 (file)
--- a/wgj58.js
+++ b/wgj58.js
@@ -235,7 +235,6 @@ class NPC_Clara extends GameNPC {
                                        { actor: this, text: "If I had no card, would I still exist?" },
                                        { actor: logic.player, text: "..." },
                                        { actor: logic.player, text: "You sound very philosophical today." } ] ));
-                               logic.closeDoor("cutedoor");
                                break;
                        case 2:
                        case 3:
@@ -273,11 +272,28 @@ class NPC_Clara extends GameNPC {
                logic.gameinterface.dropNotice(this.shortname + ": Have a great day, John!");
        }
 
+       actionTake() {
+               logic.openDoor("cutedoor");
+               return super.actionTake();
+       }
+
        endTalk() {
                return (this.talkcount < 6);
        }
 }
 
+class NPC_Carlos extends GameNPC {
+       actionTalk() {
+               super.actionTalk();
+               logic.endTalk();
+       }
+
+       actionTake() {
+               logic.openDoor("carlosdoor");
+               return super.actionTake();
+       }
+}
+
 
 class GameInterface extends Phaser.Group {
        constructor(game, parent) {
@@ -470,6 +486,10 @@ class GameLogic {
                                newChar = new NPC_Clara(object.x, object.y, 'clara', "Clara", "Clara Tnavelerri", 200);
                                this.clara = newChar;
                                break;
+                       case 'carlos':
+                               newChar = new NPC_Carlos(object.x, object.y, 'carlos', "Carlos", "Carlos Elbacalper", 150);
+                               this.carlos = newChar;
+                               break;
                        default:
                                console.error("Unknown character:", object);
                }
@@ -558,6 +578,7 @@ class GamePlay extends Phaser.State {
 
                game.load.image('player', 'john.png');
                game.load.image('clara', 'clara.png');
+               game.load.image('carlos', 'carlos.png');
                game.load.image('saiki', 'saiki.png');
                game.load.image('tileset', 'tileset.png');
                game.load.image('objects', 'objects.png');