Making townsfolk report you to a guard

This commit is contained in:
2014-06-19 20:52:57 -07:00
parent 1b351d662e
commit 23507352b8

View File

@@ -1061,8 +1061,11 @@ var AISprite = function(game, x, y, key, frame) {
this.target = nearestInGroup(this, aiSprites, "townsfolk-guard"); this.target = nearestInGroup(this, aiSprites, "townsfolk-guard");
} }
if ( this.target !== null ) { if ( this.target !== null ) {
if ( ((typeof this.target.canSeeSprite !== undefined) && var targetseesyou = false;
(this.target.canSeeSprite(this) == true)) || if ((typeof this.target.canSeeSprite !== undefined) &&
(this.target.canSeeSprite(this) == true) )
targetseesyou = true;
if ( targetseesyou ||
(game.physics.arcade.collide(this, this.target) == true) ) { (game.physics.arcade.collide(this, this.target) == true) ) {
if ( hasState(this, STATE_RUNNINGTOLIGHT) == true ) { if ( hasState(this, STATE_RUNNINGTOLIGHT) == true ) {
return; return;