Fix: Alien moveRandomPosition

This commit is contained in:
2018-12-02 14:44:01 +09:00
parent 0f799183ee
commit 7e3ec80526
2 changed files with 13 additions and 5 deletions
+12 -4
View File
@@ -15,7 +15,7 @@ function Alien(spaceship) {
game.add.existing(this);
this.moveRandomPosition();
this.setActive(true);
// this.setActive(true);
}
@@ -31,10 +31,18 @@ Alien.prototype.moveRandomPosition = function() {
var posX = Math.sin(radians) * radious;
var posY = Math.cos(radians) * radious;
this.x = this.spaceship.x + posX;
this.y = this.spaceship.y + posY;
this.x = game.world.centerX + posX;
this.y = game.world.centerY + posY;
// this.x = this.spaceship.x + posX;
// this.y = this.spaceship.y + posY;
this.angle = this.getSpriteAngle(this.angleFromAlien);
var alienAngle = this.getAngle(this.spaceship.x, this.spaceship.y, this.x, this.y);
this.angle = this.getSpriteAngle(alienAngle);
this.angleFromAlien = alienAngle;
// this.angle = this.getSpriteAngle(this.angleFromAlien);
}
Alien.prototype.update = function() {