Making AI able to 'see' the player

This commit is contained in:
2014-06-14 14:54:33 -07:00
parent 102366e3ac
commit e927396fd7

View File

@@ -599,7 +599,9 @@ var AISprite = function(game, x, y, key, frame) {
yd = -(yd); yd = -(yd);
var hyp = Math.sqrt(Number(xd * xd) + Number(yd * yd)); var hyp = Math.sqrt(Number(xd * xd) + Number(yd * yd));
if ( hyp < this.view_distance ) { if ( hyp > this.view_distance ) {
return false;
}
// View cone intersection test // View cone intersection test
var p1 = new Phaser.Point(this.x + (this.body.width / 2), var p1 = new Phaser.Point(this.x + (this.body.width / 2),
this.y); this.y);
@@ -669,7 +671,6 @@ var AISprite = function(game, x, y, key, frame) {
return false; return false;
} }
}
this.enableWordBubble = function() { this.enableWordBubble = function() {
this.enable_word_bubble = true; this.enable_word_bubble = true;