Weapon#trackRotation

trackRotation : boolean If the Weapon is tracking a Sprite, should it also track the Sprites rotation?This is useful for a game such as Asteroids, where you want the weapon to fire basedon the sprites rotation. Source code: plugins/weapon/WeaponPlugin.js (Line 350)

Weapon#trackPointer()

trackPointer(pointer, offsetX, offsetY) → {Phaser.Weapon} Sets this Weapon to track the given Pointer.When a Weapon tracks a Pointer it will automatically update its fireFrom value to match the Pointersposition within the Game World, adjusting the coordinates based on the offset arguments. This allows you to lock a Weapon to a Pointer, so that bullets are always launched from its location. Calling trackPointer will reset Weapon.trackedSprite to null, should it have been set, as you canonly tr

Weapon#trackOffset

trackOffset : Phaser.Point The Track Offset is a Point object that allows you to specify a pixel offset that bullets usewhen launching from a tracked Sprite or Pointer. For example if you've got a bullet that is 2x2 pixelsin size, but you're tracking a Sprite that is 32x32, then you can set trackOffset.x = 16 to havethe bullet launched from the center of the Sprite. Source code: plugins/weapon/WeaponPlugin.js (Line 360)

Weapon#trackedSprite

trackedSprite : Phaser.Sprite | Object The Sprite currently being tracked by the Weapon, if any.This is set via the Weapon.trackSprite method. Type Phaser.Sprite | Object Source code: plugins/weapon/WeaponPlugin.js (Line 333)

Weapon#trackedPointer

trackedPointer : Phaser.Pointer The Pointer currently being tracked by the Weapon, if any.This is set via the Weapon.trackPointer method. Source code: plugins/weapon/WeaponPlugin.js (Line 341)

Weapon#shots

shots : number The total number of bullets this Weapon has fired so far.You can limit the number of shots allowed (via fireLimit), and resetthis total via Weapon.resetShots. Source code: plugins/weapon/WeaponPlugin.js (Line 61)

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

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#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#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)