Making AI able to 'see' the player

This commit is contained in:
2014-06-14 16:50:57 -07:00
parent 65f08c1384
commit 6c1c0c1ba8

View File

@@ -592,18 +592,18 @@ var AISprite = function(game, x, y, key, frame) {
if ( hasState(this, STATE_FACE_LEFT) ) {
return new Phaser.Rectangle(this.x, this.y - 32,
-this.view_distance,
64);
96);
} else if ( hasState(this, STATE_FACE_RIGHT) ) {
return new Phaser.Rectangle(this.x + 32, this.y - 32,
32 + this.view_distance,
64);
96);
} else if ( hasState(this, STATE_FACE_DOWN) ) {
return new Phaser.Rectangle(this.x - 32, this.y + 32,
64,
32 + this.view_distance);
96,
this.view_distance);
} else if ( hasState(this, STATE_FACE_UP) ) {
return new Phaser.Rectangle(this.x - 32, this.y,
64,
96,
-this.view_distance);
} else {
return null;