Skip to content

Commit e90619b

Browse files
author
James
committed
changed return value of Plugin.Weapon's fire, fireAtXY, fireAtPointer, fireAtSprite to Phaser.Bullet
1 parent bfb12d9 commit e90619b

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/plugins/weapon/WeaponPlugin.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ Phaser.Weapon.prototype.trackPointer = function (pointer, offsetX, offsetY) {
699699
* @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.
700700
* @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.
701701
* @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.
702-
* @return {boolean} True if a bullet was successfully fired, otherwise false.
702+
* @return {Phaser.Bullet} The fired bullet if successful, null otherwise.
703703
*/
704704
Phaser.Weapon.prototype.fire = function (from, x, y) {
705705

@@ -880,7 +880,7 @@ Phaser.Weapon.prototype.fire = function (from, x, y) {
880880
this.onFireLimit.dispatch(this, this.fireLimit);
881881
}
882882
}
883-
883+
return bullet;
884884
};
885885

886886
/**
@@ -889,7 +889,7 @@ Phaser.Weapon.prototype.fire = function (from, x, y) {
889889
*
890890
* @method Phaser.Weapon#fireAtPointer
891891
* @param {Phaser.Pointer} [pointer] - The Pointer to fire the bullet towards.
892-
* @return {boolean} True if a bullet was successfully fired, otherwise false.
892+
* @return {Phaser.Bullet} The fired bullet if successful, null otherwise.
893893
*/
894894
Phaser.Weapon.prototype.fireAtPointer = function (pointer) {
895895

@@ -905,7 +905,7 @@ Phaser.Weapon.prototype.fireAtPointer = function (pointer) {
905905
*
906906
* @method Phaser.Weapon#fireAtSprite
907907
* @param {Phaser.Sprite} [sprite] - The Sprite to fire the bullet towards.
908-
* @return {boolean} True if a bullet was successfully fired, otherwise false.
908+
* @return {Phaser.Bullet} The fired bullet if successful, null otherwise.
909909
*/
910910
Phaser.Weapon.prototype.fireAtSprite = function (sprite) {
911911

@@ -920,7 +920,7 @@ Phaser.Weapon.prototype.fireAtSprite = function (sprite) {
920920
* @method Phaser.Weapon#fireAtXY
921921
* @param {number} [x] - The x coordinate, in world space, to fire the bullet towards.
922922
* @param {number} [y] - The y coordinate, in world space, to fire the bullet towards.
923-
* @return {boolean} True if a bullet was successfully fired, otherwise false.
923+
* @return {Phaser.Bullet} The fired bullet if successful, null otherwise.
924924
*/
925925
Phaser.Weapon.prototype.fireAtXY = function (x, y) {
926926

typescript/phaser.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ declare module Phaser {
809809
l: number;
810810
color: number;
811811
color32: number;
812-
rgba: string;
812+
rgba: string;
813813
}
814814

815815
class Create {
@@ -5651,10 +5651,10 @@ declare module Phaser {
56515651
createBullets(quantity?: number, key?: any, frame?: any, group?: Phaser.Group): Phaser.Weapon;
56525652
debug(x?: number, y?: number, debugBodies?: boolean): void;
56535653
destroy(): void;
5654-
fire(from?: any, x?: number, y?: number): boolean;
5655-
fireAtPointer(pointer: Phaser.Pointer): boolean;
5656-
fireAtSprite(sprite: Phaser.Sprite): boolean;
5657-
fireAtXY(x: number, y: number): boolean;
5654+
fire(from?: any, x?: number, y?: number): Phaser.Bullet;
5655+
fireAtPointer(pointer: Phaser.Pointer): Phaser.Bullet;
5656+
fireAtSprite(sprite: Phaser.Sprite): Phaser.Bullet;
5657+
fireAtXY(x: number, y: number): Phaser.Bullet;
56585658
forEach(callback: any, callbackContext: any): Phaser.Weapon;
56595659
killAll(): Phaser.Weapon;
56605660
pauseAll(): Phaser.Weapon;

0 commit comments

Comments
 (0)