From e4fbf8a88d9b60d245bc7ad538140564be1096e8 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sat, 14 Jun 2014 15:39:39 -0700 Subject: [PATCH] Making AI able to 'see' the player --- moonlight/js/moonlight-skulk.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/moonlight/js/moonlight-skulk.js b/moonlight/js/moonlight-skulk.js index 2c5b46b..de961cf 100644 --- a/moonlight/js/moonlight-skulk.js +++ b/moonlight/js/moonlight-skulk.js @@ -604,21 +604,20 @@ var AISprite = function(game, x, y, key, frame) { } var viewrect = null; - if ( hasState(this, STATE_FACE_LEFT) ) { - viewrect = Phaser.Rectangle(this.x, this.y - 32, + viewrect = new Phaser.Rectangle(this.x, this.y - 32, this.x - this.view_distance, this.y + 64); } else if ( hasState(this, STATE_FACE_RIGHT) ) { - viewrect = Phaser.Rectangle(this.x + 32, this.y - 32, + viewrect = new Phaser.Rectangle(this.x + 32, this.y - 32, this.x + 32 + this.view_distance, this.y + 64); } else if ( hasState(this, STATE_FACE_DOWN) ) { - viewrect = Phaser.Rectangle(this.x - 32, this.y + 32, + viewrect = new Phaser.Rectangle(this.x - 32, this.y + 32, this.x + 64, this.y + 32 + this.view_distance); } else if ( hasState(this, STATE_FACE_UP) ) { - viewrect = Phaser.Rectangle(this.x - 32, this.y, + viewrect = new Phaser.Rectangle(this.x - 32, this.y, this.x + 64, this.y - this.view_distance); } else {