From ba16a99ba93e37ad14fabfa623fb77c5a23c9269 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Thu, 12 Jun 2014 02:09:20 -0700 Subject: [PATCH] Moved to graphical word bubbles --- moonlight/js/moonlight-skulk.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/moonlight/js/moonlight-skulk.js b/moonlight/js/moonlight-skulk.js index 9e914f9..fb129b8 100644 --- a/moonlight/js/moonlight-skulk.js +++ b/moonlight/js/moonlight-skulk.js @@ -536,11 +536,12 @@ var AISprite = function(game, x, y, spritetype) { } this.clearWordBubble = function() { - this.bubble.destroy(); + if ( this.bubble !== null ) + this.bubble.destroy(); this.bubble = null; this.enable_word_bubble = false; timer = game.time.create(false); - timerev = timer.add(10000, this.enableWordBubble, this); + timerev = timer.add(10000 + (game.rnd.integerInRange(0, 10) * 1000), this.enableWordBubble, this); timer.start() } @@ -635,7 +636,7 @@ var AISprite = function(game, x, y, spritetype) { 'townsfolk-guard-1', 'townsfolk-guard-2' ]; - this.bubble = null; + this.clearWordBubble(); this.state = STATE_UNAWARE; Phaser.Sprite.call(this, game, x, y, spritenames_by_type[spritetype]);