Making AI able to 'see' the player

This commit is contained in:
2014-06-14 15:13:56 -07:00
parent 956c66a886
commit b2fc1deb09

View File

@@ -648,14 +648,14 @@ var AISprite = function(game, x, y, key, frame) {
// FIXME : There has got to be a better way to do this
var rectLines = [
new Phaser.Line(spr.body.left, spr.body.top,
spr.body.right, spr.body.top),
new Phaser.Line(spr.body.right, spr.body.top,
spr.body.right, spr.body.bottom),
new Phaser.Line(spr.body.right, spr.body.bottom,
spr.body.left, spr.body.bottom),
new Phaser.Line(spr.body.left, spr.body.bottom,
spr.body.left, spr.body.top)
new Phaser.Line(spr.x, spr.y,
spr.x + spr.body.width, spr.y),
new Phaser.Line(spr.x + spr.body.width, spr.y,
spr.x + spr.body.width, spr.y + spr.body.height),
new Phaser.Line(spr.x + spr.body.width, spr.y + spr.body.height,
spr.x, spr.y + spr.body.height),
new Phaser.Line(spr.x, spr.y + spr.body.height,
spr.x, spr.y);
];
var withinView = false;
rectLines.forEach(function(sl) {