From: MegaBrutal Date: Sun, 16 Sep 2018 02:40:40 +0000 (+0200) Subject: Happy value X-Git-Tag: early-release~7 X-Git-Url: http://git.megabrutal.com/?p=wgj58.git;a=commitdiff_plain;h=411f2853d9a619185ca5d7cdac63e82f0c56415c Happy value For NPCs, this indicates whether the character's special needs are met. modified: wgj58.js --- diff --git a/wgj58.js b/wgj58.js index 78cd42b..a50e494 100644 --- a/wgj58.js +++ b/wgj58.js @@ -172,11 +172,13 @@ class GameNPC extends Phaser.Sprite { this.interaction_distance = interaction_distance; this.interactable = false; this.talkcount = 0; + this.happy = false; } kill() { super.kill(); this.exists = false; + this.happy = false; // Dead people are not happy. } update() { @@ -215,6 +217,11 @@ class GameNPC extends Phaser.Sprite { return true; } + makeHappy() { + this.happy = true; + console.log(this.shortname, "is happy!"); + } + offscreenTeleportation(newPosition, callback, callbackValue) { this.teleport_instructions = { newPosition: newPosition, callback: callback, callbackValue: callbackValue }; console.log("Offscreen teleport request registered:", this.teleport_instructions); @@ -508,6 +515,8 @@ class NPC_Saiki extends GameNPC { tpDone(value) { console.log("Woot-woot! Teleport complete:", value); + value.makeHappy(); + logic.carlos.makeHappy(); } }