mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Return null instead of false.
This commit is contained in:
parent
ec29511f42
commit
1193bc7d47
1 changed files with 4 additions and 2 deletions
|
@ -707,13 +707,13 @@ Phaser.Weapon.prototype.trackPointer = function (pointer, offsetX, offsetY) {
|
||||||
* @param {Phaser.Sprite|Phaser.Point|Object} [from] - Optionally fires the bullet **from** the `x` and `y` properties of this object. If set this overrides `Weapon.trackedSprite` or `trackedPointer`. Pass `null` to ignore it.
|
* @param {Phaser.Sprite|Phaser.Point|Object} [from] - Optionally fires the bullet **from** the `x` and `y` properties of this object. If set this overrides `Weapon.trackedSprite` or `trackedPointer`. Pass `null` to ignore it.
|
||||||
* @param {number} [x] - The x coordinate, in world space, to fire the bullet **towards**. If left as `undefined` the bullet direction is based on its angle.
|
* @param {number} [x] - The x coordinate, in world space, to fire the bullet **towards**. If left as `undefined` the bullet direction is based on its angle.
|
||||||
* @param {number} [y] - The y coordinate, in world space, to fire the bullet **towards**. If left as `undefined` the bullet direction is based on its angle.
|
* @param {number} [y] - The y coordinate, in world space, to fire the bullet **towards**. If left as `undefined` the bullet direction is based on its angle.
|
||||||
* @return {Phaser.Bullet} The fired bullet if successful, null otherwise.
|
* @return {Phaser.Bullet} The fired bullet, if a launch was successful, otherwise `null`.
|
||||||
*/
|
*/
|
||||||
Phaser.Weapon.prototype.fire = function (from, x, y) {
|
Phaser.Weapon.prototype.fire = function (from, x, y) {
|
||||||
|
|
||||||
if (this.game.time.now < this._nextFire || (this.fireLimit > 0 && this.shots === this.fireLimit))
|
if (this.game.time.now < this._nextFire || (this.fireLimit > 0 && this.shots === this.fireLimit))
|
||||||
{
|
{
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var speed = this.bulletSpeed;
|
var speed = this.bulletSpeed;
|
||||||
|
@ -922,7 +922,9 @@ Phaser.Weapon.prototype.fire = function (from, x, y) {
|
||||||
this.onFireLimit.dispatch(this, this.fireLimit);
|
this.onFireLimit.dispatch(this, this.fireLimit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bullet;
|
return bullet;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue