Making AI able to 'see' the player
This commit is contained in:
@@ -599,7 +599,9 @@ var AISprite = function(game, x, y, key, frame) {
|
||||
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
|
||||
var p1 = new Phaser.Point(this.x + (this.body.width / 2),
|
||||
this.y);
|
||||
@@ -669,7 +671,6 @@ var AISprite = function(game, x, y, key, frame) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
this.enableWordBubble = function() {
|
||||
this.enable_word_bubble = true;
|
||||
|
||||
Reference in New Issue
Block a user