mirror of
https://github.com/wassname/phaser.git
synced 2026-09-13 12:51:23 +08:00
Enemy tanks, now firing.
This commit is contained in:
+20
-2
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user