Making AI able to 'see' the player
This commit is contained in:
@@ -626,9 +626,11 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
|
|
||||||
var sprrect = Phaser.Rectangle(spr.x, spr.y, spr.x + 32, spr.y + 32);
|
var sprrect = Phaser.Rectangle(spr.x, spr.y, spr.x + 32, spr.y + 32);
|
||||||
|
|
||||||
return (
|
if ( viewrect.intersects(sprrect) || viewrect.containsRect(sprrect) ) {
|
||||||
viewrect.intersects(sprrect) ||
|
console.log("I SEE YOU YOU FUCKER");
|
||||||
viewrect.containsRect(sprrect) );
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.enableWordBubble = function() {
|
this.enableWordBubble = function() {
|
||||||
@@ -1097,7 +1099,7 @@ GameState.prototype.update = function()
|
|||||||
}
|
}
|
||||||
if ( x.collide_with_player == false )
|
if ( x.collide_with_player == false )
|
||||||
return;
|
return;
|
||||||
x.canSeeSprite(player, true);
|
x.canSeeSprite(player, false);
|
||||||
this.physics.arcade.collide(x, player);
|
this.physics.arcade.collide(x, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user