Making AI able to 'see' the player

This commit is contained in:
2014-06-14 14:51:45 -07:00
parent 7433462184
commit 102366e3ac

View File

@@ -625,20 +625,20 @@ var AISprite = function(game, x, y, key, frame) {
*/ */
if ( hasState(this, STATE_FACE_LEFT) ) { if ( hasState(this, STATE_FACE_LEFT) ) {
rotateAllpoints([p1, p2, p3, p4], rotatePoints([p1, p2, p3, p4],
this.x + (this.body.width / 2), this.x + (this.body.width / 2),
this.y + (this.body.height / 2), this.y + (this.body.height / 2),
-90); -90);
} else if ( hasState(this, STATE_FACE_RIGHT) ) { } else if ( hasState(this, STATE_FACE_RIGHT) ) {
rotateAllpoints([p1, p2, p3, p4], rotatePoints([p1, p2, p3, p4],
this.x + (this.body.width / 2), this.x + (this.body.width / 2),
this.y + (this.body.height / 2), this.y + (this.body.height / 2),
90); 90);
} else if ( hasState(this, STATE_FACE_DOWN) ) { } else if ( hasState(this, STATE_FACE_DOWN) ) {
rotateAllpoints([p1, p2, p3, p4], rotatePoints([p1, p2, p3, p4],
this.x + (this.body.width / 2), this.x + (this.body.width / 2),
this.y + (this.body.height / 2), this.y + (this.body.height / 2),
180); 180);
} }