mirror of
https://github.com/wassname/phaser.git
synced 2026-08-14 12:40:17 +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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -171,9 +171,6 @@ Phaser.RandomDataGenerator.prototype = {
|
||||
*/
|
||||
realInRange: function (min, max) {
|
||||
|
||||
min = min || 0;
|
||||
max = max || 0;
|
||||
|
||||
return this.frac() * (max - min) + min;
|
||||
|
||||
},
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user