Weapon#forEach()

forEach(callback, callbackContext, args) → {Phaser.Weapon} Call a function on each in-flight bullet in this Weapon. See forEachExists for more details. Parameters Name Type Argument Default Description callback function The function that will be called for each applicable child. The child will be passed as the first argument. callbackContext object The context in which the function should be called (usually 'this'). args any <optional> <repeatable> (none) Additio

Weapon#killAll()

killAll() → {Phaser.Weapon} Calls Bullet.kill on every in-flight bullet in this Weapon.Also re-enables their physics bodies, should they have been disabled via pauseAll. Returns Phaser.Weapon - This Weapon instance. Source code: plugins/weapon/WeaponPlugin.js (Line 541)

Weapon#onFire

onFire : Phaser.Signal The onFire Signal is dispatched each time Weapon.fire is called, and a Bullet issuccessfully launched. The callback is set two arguments: a reference to the bullet sprite itself,and a reference to the Weapon that fired the bullet. Source code: plugins/weapon/WeaponPlugin.js (Line 306)

Weapon#onFireLimit

onFireLimit : Phaser.Signal The onFireLimit Signal is dispatched if Weapon.fireLimit is > 0, and a bullet launch takes the numberof shots fired to equal the fire limit.The callback is sent two arguments: A reference to the Weapon that hit the limit, and the value ofWeapon.fireLimit. Source code: plugins/weapon/WeaponPlugin.js (Line 325)

Weapon#onKill

onKill : Phaser.Signal The onKill Signal is dispatched each time a Bullet that is in-flight is killed. This can be the resultof leaving the Weapon bounds, an expiring lifespan, or exceeding a specified distance.The callback is sent one argument: A reference to the bullet sprite itself. Source code: plugins/weapon/WeaponPlugin.js (Line 315)

Weapon#pauseAll()

pauseAll() → {Phaser.Weapon} Sets Body.enable to false on each bullet in this Weapon.This has the effect of stopping them in-flight should they be moving.It also stops them being able to be checked for collision. Returns Phaser.Weapon - This Weapon instance. Source code: plugins/weapon/WeaponPlugin.js (Line 509)

Weapon#resetShots()

resetShots(newLimit) → {Phaser.Weapon} Resets the Weapon.shots counter back to zero. This is used when you've setWeapon.fireLimit, and have hit (or just wish to reset) your limit. Parameters Name Type Argument Description newLimit integer <optional> Optionally set a new Weapon.fireLimit. Returns Phaser.Weapon - This Weapon instance. Source code: plugins/weapon/WeaponPlugin.js (Line 558)

Weapon#resumeAll()

resumeAll() → {Phaser.Weapon} Sets Body.enable to true on each bullet in this Weapon.This has the effect of resuming their motion should they be in-flight.It also enables them for collision checks again. Returns Phaser.Weapon - This Weapon instance. Source code: plugins/weapon/WeaponPlugin.js (Line 525)

Weapon#setBulletBodyOffset()

setBulletBodyOffset(width, height, offsetX, offsetY) → {Phaser.Weapon} You can modify the size of the physics Body the Bullets use to be any dimension you need.This allows you to make it smaller, or larger, than the parent Sprite.You can also control the x and y offset of the Body. This is the position of theBody relative to the top-left of the Sprite texture. For example: If you have a Sprite with a texture that is 80x100 in size,and you want the physics body to be 32x32 pixels in the middle

Weapon#setBulletFrames()

setBulletFrames(min, max, cycle, random) → {Phaser.Weapon} Sets the texture frames that the bullets can use when being launched. This is intended for use when you've got numeric based frames, such as those loaded via a Sprite Sheet. It works by calling Phaser.ArrayUtils.numberArray internally, using the min and max valuesprovided. Then it sets the frame index to be zero. You can optionally set the cycle and random booleans, to allow bullets to cycle through the frameswhen they're fired, or pi