@@ -690,10 +690,10 @@ Phaser.Weapon.prototype.trackPointer = function (pointer, offsetX, offsetY) {
690690
691691/**
692692* Attempts to fire a single Bullet. If there are no more bullets available in the pool, and the pool cannot be extended,
693- * then this method returns `false `. It will also return false if not enough time has expired since the last time
693+ * then this method returns `null `. It will also return `null` if not enough time has expired since the last time
694694* the Weapon was fired, as defined in the `Weapon.fireRate` property.
695695*
696- * Otherwise the first available bullet is selected and launched .
696+ * Otherwise the first available bullet is selected, launched, and returned .
697697*
698698* The arguments are all optional, but allow you to control both where the bullet is launched from, and aimed at.
699699*
@@ -979,9 +979,9 @@ Phaser.Weapon.prototype.fireAtXY = function (x, y) {
979979* For example: If you have a Sprite with a texture that is 80x100 in size,
980980* and you want the physics body to be 32x32 pixels in the middle of the texture, you would do:
981981*
982- * `setSize(32, 32, 24, 34)`
982+ * `setSize(32 / Math.abs(this.scale.x) , 32 / Math.abs(this.scale.y) , 24, 34)`
983983*
984- * Where the first two parameters is the new Body size (32x32 pixels).
984+ * Where the first two parameters are the new Body size (32x32 pixels) relative to the Sprite's scale .
985985* 24 is the horizontal offset of the Body from the top-left of the Sprites texture, and 34
986986* is the vertical offset.
987987*
@@ -1127,8 +1127,10 @@ Object.defineProperty(Phaser.Weapon.prototype, "bulletClass", {
11271127
11281128 this . _bulletClass = classType ;
11291129
1130- this . bullets . classType = this . _bulletClass ;
1131-
1130+ //prevent crash if weapon's bullets have not yet been initialized
1131+ if ( this . bullets ) {
1132+ this . bullets . classType = this . _bulletClass ;
1133+ }
11321134 }
11331135
11341136} ) ;
0 commit comments