diff --git a/src/plugins/weapon/WeaponPlugin.js b/src/plugins/weapon/WeaponPlugin.js index fe6cbf380..0b3ed9233 100644 --- a/src/plugins/weapon/WeaponPlugin.js +++ b/src/plugins/weapon/WeaponPlugin.js @@ -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 {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. -* @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) { if (this.game.time.now < this._nextFire || (this.fireLimit > 0 && this.shots === this.fireLimit)) { - return false; + return null; } var speed = this.bulletSpeed; @@ -922,7 +922,9 @@ Phaser.Weapon.prototype.fire = function (from, x, y) { this.onFireLimit.dispatch(this, this.fireLimit); } } + return bullet; + }; /**