Enemy tanks, now firing.

This commit is contained in:
photonstorm
2013-10-09 07:11:36 +01:00
parent ca9321ef42
commit 29acf7fb4b
7 changed files with 182 additions and 43 deletions
+20 -2
View File
@@ -223,7 +223,16 @@ Object.defineProperty(Phaser.World.prototype, "centerY", {
Object.defineProperty(Phaser.World.prototype, "randomX", {
get: function () {
return this.game.rnd.integerInRange(this.bounds.x, this.bounds.width);
if (this.bounds.x < 0)
{
return this.game.rnd.integerInRange(this.bounds.x, (this.bounds.width - Math.abs(this.bounds.x)));
}
else
{
return this.game.rnd.integerInRange(this.bounds.x, this.bounds.width);
}
}
});
@@ -236,7 +245,16 @@ Object.defineProperty(Phaser.World.prototype, "randomX", {
Object.defineProperty(Phaser.World.prototype, "randomY", {
get: function () {
return this.game.rnd.integerInRange(this.bounds.y, this.bounds.height);
if (this.bounds.y < 0)
{
return this.game.rnd.integerInRange(this.bounds.y, (this.bounds.height - Math.abs(this.bounds.y)));
}
else
{
return this.game.rnd.integerInRange(this.bounds.y, this.bounds.height);
}
}
});