From 648fdb5aa0b755e8192481ff177940da29cd3963 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sun, 15 Jun 2014 17:50:24 -0700 Subject: [PATCH] AISprite always alerts when you touch it --- 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 9a1c414..acc69cc 100644 --- a/moonlight/js/moonlight-skulk.js +++ b/moonlight/js/moonlight-skulk.js @@ -857,7 +857,6 @@ var AISprite = function(game, x, y, key, frame) { } if ( this.sprite_canmove == false) { - this.body.immovable = true; return; } if ( game.rnd.integerInRange(0, 100) < 95 ) @@ -929,6 +928,7 @@ var AISprite = function(game, x, y, key, frame) { Phaser.Sprite.call(this, game, x, y, null); game.physics.arcade.enable(this); + this.body.immovable = true; this.awareness_change_enabled = true; this.lightmeter = 1.0; this.sprite_can_see_lightmeter = 0.5; @@ -1320,11 +1320,14 @@ GameState.prototype.update = function() if ( x.collide_with_player == false ) return; if ( x.canSeeSprite(player, false) == true ) { - if ( player.lightmeter >= x.sprite_can_see_lightmeter ) { + if ( this.physics.arcade.collide(x, player) ) { + x.setAwarenessEffect(STATE_ALERTED); + } else if ( player.lightmeter >= x.sprite_can_see_lightmeter ) { x.setAwarenessEffect(STATE_ALERTED); } else { x.setAwarenessEffect(STATE_CONCERNED); } + return; } else { x.setAwarenessEffect(STATE_LOSTHIM); }