From 37ca9fe52da9305497d7f7134a021ed442a825ce Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sun, 15 Jun 2014 14:13:24 -0700 Subject: [PATCH] Working on effect bubbles (visual indicators for awareness state changes) --- moonlight/js/moonlight-skulk.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/moonlight/js/moonlight-skulk.js b/moonlight/js/moonlight-skulk.js index 67a9946..0dc6b14 100644 --- a/moonlight/js/moonlight-skulk.js +++ b/moonlight/js/moonlight-skulk.js @@ -696,6 +696,9 @@ var AISprite = function(game, x, y, key, frame) { this.setAwarenessEffect = function(state) { var animkey = ""; + + setAwarenessState(this, state); + if ( this.awareness_effect !== null ) { this.awareness_effect.alive = false; this.awareness_effect.destroy(); @@ -1276,11 +1279,11 @@ GameState.prototype.update = function() return; if ( x.canSeeSprite(player, false) == true ) { if ( hasState(x, STATE_ALERTED) == false ) { - setAwarenessState(x, STATE_ALERTED); + x.setAwarenessEffect(x, STATE_ALERTED); } } else { if ( hasState(x, STATE_ALERTED) == true ) { - setAwarenessState(x, STATE_LOSTHIM); + x.setAwarenessEffect(x, STATE_LOSTHIM); } } this.physics.arcade.collide(x, player);