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);
}
}
});
-3
View File
@@ -171,9 +171,6 @@ Phaser.RandomDataGenerator.prototype = {
*/
realInRange: function (min, max) {
min = min || 0;
max = max || 0;
return this.frac() * (max - min) + min;
},
+2 -2
View File
@@ -984,7 +984,7 @@ Phaser.Physics.Arcade.prototype = {
},
/**
* Move the given display object towards the pointer at a steady velocity. If no pointer is given it will use Phaser.Input.activePointer.
* Move the given display object towards the destination object at a steady velocity.
* If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
* Timings are approximate due to the way browser timers work. Allow for a variance of +- 50ms.
* Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course.
@@ -1003,7 +1003,7 @@ Phaser.Physics.Arcade.prototype = {
speed = speed || 60;
maxTime = maxTime || 0;
this._angle = Math.atan2(destination.y - displayObject.y, destination.x - displaxObject.x);
this._angle = Math.atan2(destination.y - displayObject.y, destination.x - displayObject.x);
if (maxTime > 0)
{