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 the
Body 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 of the texture, you would do:
setSize(32, 32, 24, 34)
Where the first two parameters is the new Body size (32x32 pixels).
24 is the horizontal offset of the Body from the top-left of the Sprites texture, and 34
is the vertical offset.
Parameters
Name | Type | Argument | Description |
---|---|---|---|
width | number | The width of the Body. | |
height | number | The height of the Body. | |
offsetX | number | <optional> | The X offset of the Body from the top-left of the Sprites texture. |
offsetY | number | <optional> | The Y offset of the Body from the top-left of the Sprites texture. |
Returns
The Weapon Plugin.
- Source code: plugins/weapon/WeaponPlugin.js (Line 973)
Please login to continue.