Fix: Alien moveRandomPosition
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user