Return null instead of false.

This commit is contained in:
Richard Davey 2016-09-07 23:25:37 +01:00
parent ec29511f42
commit 1193bc7d47

View file

@ -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;
}; };
/** /**