diff --git a/docs/classes/Bullet.html b/docs/classes/Bullet.html index 3a74c83..768bdce 100644 --- a/docs/classes/Bullet.html +++ b/docs/classes/Bullet.html @@ -2,7 +2,7 @@
Bullets are used by the Weapon class, and are normal Sprites, with a few extra properties in the data manager to handle Weapon specific features.
-A reference to the currently running scene.
The x coordinate (in world space) to position the Bullet at.
@@ -59,7 +59,7 @@ on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these reasons try to be careful about the construction of your Scene and the frequency of which blend modes are used. -This Bullet's Physics Body.
A bitmask that controls if this Game Object is drawn by a Camera or not. @@ -134,7 +134,7 @@
Does this Game Object have a tint applied?
It checks to see if the 4 tint properties are set to the value 0xffffff
and that the tintFill
property is false
. This indicates that a Game Object isn't tinted.
If you've set Weapon.bulletKillType to KILL_LIFESPAN this property contains the lifespan the Bullets have set on launch. The value is given in milliseconds. When a Bullet hits its lifespan limit it will be automatically killed.
@@ -408,7 +408,7 @@ The returned point is calculated in local space and does not factor in any parent containersAn object to store the values in. If not provided a new Vector2 will be created.
-Returns an array containing the display list index of either this Game Object, or if it has one, its parent Container. It then iterates up through all of the parent containers until it hits the root of the display list (which is index 0 in the returned array).
@@ -498,10 +498,11 @@This should only be called during the instantiation of the Game Object. After that, use setPipeline
.
Either the string-based name of the pipeline, or a pipeline instance to set.
-Kills the Bullet, freeing it up for re-use by the Weapon bullet pool. Also dispatches the BULLET_KILL event on the Weapon.
-This instance of the bullet class
+This instance of the bullet class
Return the number of listeners listening to a given event.
The current timestamp.
The delta time, in ms, elapsed since the last frame.
-Prepares this bullet to be fired and to interact with the rest of the scene again.
The width of the crop rectangle in pixels.
The height of the crop rectangle in pixels.
-Adds a Data Manager component to this Game Object.
The depth of this Game Object within the Scene.
@@ -1094,7 +1095,7 @@ If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.Toggles the vertical flipped state of this Game Object.
-Updates the Bullet, killing as required.
Updates the Display Origin cached values internally stored on this Game Object. diff --git a/docs/classes/Weapon.html b/docs/classes/Weapon.html index b3e2736..c3ee14d 100644 --- a/docs/classes/Weapon.html +++ b/docs/classes/Weapon.html @@ -15,7 +15,7 @@ Phaser.Scene.create method:
var weapon = this.add.weapon(10, 'bullet');
weapon.fireFrom.setPosition(300, 300);
this.input.on(Phaser.Input.Events.POINTER_DOWN, weapon.fire, this);
-A reference to the Phaser.Scene instance.
The quantity of bullets to seed the Weapon with. If -1 it will set the pool to automatically expand.
@@ -25,151 +25,151 @@If the Sprite image contains multiple frames you can specify which one to use here.
Optional Group to add the object to.
-Should debug graphics render for physics bodies?
-Log level for this weapon. Either warn
, error
or off
. warn
is the default.
If you change this, please do so before setting any other properties.
The scene the Weapon is bound to
-Should the bullet pool run out of bullets (i.e. they are all in flight) then this boolean controls if the Group will create a brand new bullet object or not.
Should the bullet pool run out of bullets (i.e. they are all in flight) then this boolean controls if the Group will create a brand new bullet object or not.
-Will this weapon auto fire? If set to true then a new bullet will be fired based on the fireRate value.
Will this weapon auto fire? If set to true then a new bullet will be fired based on the fireRate value.
-This Rectangle defines the bounds that are used when determining if a Bullet should be killed or not. It's used in combination with bulletKillType when that is set to either KILL_WEAPON_BOUNDS or KILL_STATIC_BOUNDS. If you are not using either of these kill types then the bounds are ignored. If you are tracking a Sprite or Point then the bounds are centered on that object every frame.
-This Rectangle defines the bounds that are used when determining if a Bullet should be killed or not. It's used in combination with bulletKillType when that is set to either KILL_WEAPON_BOUNDS or KILL_STATIC_BOUNDS. If you are not using either of these kill types then the bounds are ignored. If you are tracking a Sprite or Point then the bounds are centered on that object every frame.
-An optional angle offset applied to the Bullets when they are launched. This is useful if for example your bullet sprites have been drawn facing up, instead of to the right, and you want to fire them at an angle. In which case you can set the angle offset to be 90 and they'll be properly rotated when fired.
An optional angle offset applied to the Bullets when they are launched. This is useful if for example your bullet sprites have been drawn facing up, instead of to the right, and you want to fire them at an angle. In which case you can set the angle offset to be 90 and they'll be properly rotated when fired.
-This is a variance added to the angle of Bullets when they are fired. If you fire from an angle of 90 and have a bulletAngleVariance of 20 then the actual angle of the Bullets will be between 70 and 110 degrees. This is a quick way to add a great 'spread' effect to a Weapon.
This is a variance added to the angle of Bullets when they are fired. If you fire from an angle of 90 and have a bulletAngleVariance of 20 then the actual angle of the Bullets will be between 70 and 110 degrees. This is a quick way to add a great 'spread' effect to a Weapon.
-The string based name of the animation that the Bullet will be given on launch. This is set via addBulletAnimation.
The string based name of the animation that the Bullet will be given on launch. This is set via addBulletAnimation.
-The Class of the bullets that are launched by this Weapon. Defaults to Bullet, but can be overridden before calling createBullets and set to your own class type.
It should be a class (or constructor function) accepting the same params as Bullet,
i.e. (scene:
Phaser.Scene
, x: number, y: number, key: string, frame: string | number)
.
The Class of the bullets that are launched by this Weapon. Defaults to Bullet, but can be overridden before calling createBullets and set to your own class type.
It should be a class (or constructor function) accepting the same params as Bullet,
i.e. (scene:
Phaser.Scene
, x: number, y: number, key: string, frame: string | number)
.
Should bullets collide with the World bounds or not?
Should bullets collide with the World bounds or not?
-The Texture Frame that the Bullets use when rendering. Changing this has no effect on bullets in-flight, only on newly spawned bullets.
The Texture Frame that the Bullets use when rendering. Changing this has no effect on bullets in-flight, only on newly spawned bullets.
-If you've added a set of frames via setBulletFrames then you can optionally chose for each Bullet fired to use the next frame in the set. The frame index is then advanced one frame until it reaches the end of the set, then it starts from the start again. Cycling frames like this allows you to create varied bullet effects via sprite sheets.
If you've added a set of frames via setBulletFrames then you can optionally chose for each Bullet fired to use the next frame in the set. The frame index is then advanced one frame until it reaches the end of the set, then it starts from the start again. Cycling frames like this allows you to create varied bullet effects via sprite sheets.
-The index of the frame within bulletFrames that is currently being used.
This value is only used if bulletFrameCycle is set to true
.
The index of the frame within bulletFrames that is currently being used.
This value is only used if bulletFrameCycle is set to true
.
If you've added a set of frames via setBulletFrames then you can optionally chose for each Bullet fired to pick a random frame from the set.
If you've added a set of frames via setBulletFrames then you can optionally chose for each Bullet fired to pick a random frame from the set.
-This array stores the frames added via setBulletFrames.
-This array stores the frames added via setBulletFrames.
-This is the acceleration due to gravity added to the Bullets physics body when fired, in pixels per second squared. Total gravity is the sum of this vector and the simulation's gravity.
-This is the acceleration due to gravity added to the Bullets physics body when fired, in pixels per second squared. Total gravity is the sum of this vector and the simulation's gravity.
-When a Bullet is fired it can optionally inherit the velocity of the trackedSprite if set.
When a Bullet is fired it can optionally inherit the velocity of the trackedSprite if set.
-The Texture Key that the Bullets use when rendering. Changing this has no effect on bullets in-flight, only on newly spawned bullets.
The Texture Key that the Bullets use when rendering. Changing this has no effect on bullets in-flight, only on newly spawned bullets.
-If you've set bulletKillType to KILL_DISTANCE this controls the distance the Bullet can travel before it is automatically killed. The distance is given in pixels.
If you've set bulletKillType to KILL_DISTANCE this controls the distance the Bullet can travel before it is automatically killed. The distance is given in pixels.
-This controls how the bullets will be killed. The default is KILL_WORLD_BOUNDS.
There are 7 different "kill types" available:
This controls how the bullets will be killed. The default is KILL_WORLD_BOUNDS.
There are 7 different "kill types" available:
If you've set bulletKillType to KILL_LIFESPAN this controls the amount of lifespan the Bullets have set on launch. The value is given in milliseconds. When a Bullet hits its lifespan limit it will be automatically killed.
If you've set bulletKillType to KILL_LIFESPAN this controls the amount of lifespan the Bullets have set on launch. The value is given in milliseconds. When a Bullet hits its lifespan limit it will be automatically killed.
-Bullets can optionally adjust their rotation in-flight to match their velocity. This can create the effect of a bullet 'pointing' to the path it is following, for example an arrow being fired from a bow, and works especially well when added to bulletGravity.
Bullets can optionally adjust their rotation in-flight to match their velocity. This can create the effect of a bullet 'pointing' to the path it is following, for example an arrow being fired from a bow, and works especially well when added to bulletGravity.
-The initial velocity of fired bullets, in pixels per second.
The initial velocity of fired bullets, in pixels per second.
-This is a variance added to the speed of Bullets when they are fired. If bullets have a bulletSpeed value of 200, and a bulletSpeedVariance of 50 then the actual speed of the Bullets will be between 150 and 250 pixels per second.
This is a variance added to the speed of Bullets when they are fired. If bullets have a bulletSpeed value of 200, and a bulletSpeedVariance of 50 then the actual speed of the Bullets will be between 150 and 250 pixels per second.
-Should the Bullets wrap around the world bounds? This automatically calls World.wrap on the Bullet each frame. See the docs for that method for details.
Should the Bullets wrap around the world bounds? This automatically calls World.wrap on the Bullet each frame. See the docs for that method for details.
-If bulletWorldWrap is true then you can provide an optional padding value with this property. It's added to the calculations determining when the Bullet should wrap around the world or not. The value is given in pixels.
If bulletWorldWrap is true then you can provide an optional padding value with this property. It's added to the calculations determining when the Bullet should wrap around the world or not. The value is given in pixels.
-The angle at which the bullets are fired. This can be a const such as ANGLE_UP or it can be any number from 0 to 360 inclusive, where 0 degrees is to the right.
The angle at which the bullets are fired. This can be a const such as ANGLE_UP or it can be any number from 0 to 360 inclusive, where 0 degrees is to the right.
-This is a Rectangle from within which the bullets are fired. By default it's a 1x1 rectangle, the equivalent of a Point. But you can change the width and height, and if larger than 1x1 it'll pick a random point within the rectangle to launch the bullet from.
-This is a Rectangle from within which the bullets are fired. By default it's a 1x1 rectangle, the equivalent of a Point. But you can change the width and height, and if larger than 1x1 it'll pick a random point within the rectangle to launch the bullet from.
-The maximum number of shots that this Weapon is allowed to fire before it stops. When the limit is hit the WEAPON_FIRE_LIMIT event is dispatched. You can reset the shot counter via resetShots.
The maximum number of shots that this Weapon is allowed to fire before it stops. When the limit is hit the WEAPON_FIRE_LIMIT event is dispatched. You can reset the shot counter via resetShots.
-The minimum interval between shots, in milliseconds.
The minimum interval between shots, in milliseconds.
-This is a modifier that is added to the fireRate each update to add variety to the firing rate of the Weapon. The value is given in milliseconds. If you've a fireRate of 200 and a fireRateVariance of 50 then the actual firing rate of the Weapon will be between 150 and 250.
This is a modifier that is added to the fireRate each update to add variety to the firing rate of the Weapon. The value is given in milliseconds. If you've a fireRate of 200 and a fireRateVariance of 50 then the actual firing rate of the Weapon will be between 150 and 250.
-If you want this Weapon to be able to fire more than 1 bullet in a single
update, then set this property to true
. When true
the Weapon plugin won't
set the shot / firing timers until the postRender phase of the game loop.
This means you can call fire (and similar methods) as often as you like in one
single game update.
If you want this Weapon to be able to fire more than 1 bullet in a single
update, then set this property to true
. When true
the Weapon plugin won't
set the shot / firing timers until the postRender phase of the game loop.
This means you can call fire (and similar methods) as often as you like in one
single game update.
The total number of bullets this Weapon has fired so far. You can limit the number of shots allowed (via fireLimit), and reset this total via resetShots.
The total number of bullets this Weapon has fired so far. You can limit the number of shots allowed (via fireLimit), and reset this total via resetShots.
-The Track Offset is a Vector2 object that allows you to specify a pixel offset that bullets use
when launching from a tracked Sprite or Pointer. For example if you've got a bullet that is 2x2 pixels
in size, but you're tracking a Sprite that is 32x32, then you can set trackOffset.x = 16
to have
the bullet launched from the center of the Sprite.
The Track Offset is a Vector2 object that allows you to specify a pixel offset that bullets use
when launching from a tracked Sprite or Pointer. For example if you've got a bullet that is 2x2 pixels
in size, but you're tracking a Sprite that is 32x32, then you can set trackOffset.x = 16
to have
the bullet launched from the center of the Sprite.
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 based on the sprites rotation.
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 based on the sprites rotation.
-The Pointer currently being tracked by the Weapon, if any. This is set via the trackPointer method.
-The Pointer currently being tracked by the Weapon, if any. This is set via the trackPointer method.
-The Sprite currently being tracked by the Weapon, if any. This is set via the trackSprite method.
-The Sprite currently being tracked by the Weapon, if any. This is set via the trackSprite method.
-The x coordinate from which bullets are fired. This is the same as Weapon.fireFrom.x, and can be overridden by the fire arguments.
-The x coordinate from which bullets are fired. This is the same as Weapon.fireFrom.x, and can be overridden by the fire arguments.
-The y coordinate from which bullets are fired. This is the same as Weapon.fireFrom.y, and can be overridden by the fire arguments.
-The y coordinate from which bullets are fired. This is the same as Weapon.fireFrom.y, and can be overridden by the fire arguments.
-Adds a new animation under the given key. Optionally set the frames, frame rate and loop. The arguments are all the same as for AnimationManager.add, and work in the same way.
bulletAnimation will be set to this animation after it's created. From that point on, all @@ -412,7 +412,7 @@
The listener function.
The context to invoke the listener with. Default this.
-This method performs two actions: First it will check to see if the
bullets Group exists or not, and if not it creates it, adding its
children to the group
given as the 4th argument.
Optional Group to add the object to.
This Weapon instance.
-Destroys this Weapon. You must release everything in here, all references, all objects, free it all up.
Additional arguments that will be passed to the event handler.
Return an array listing the events for which the emitter has registered listeners.
-Attempts to fire a single Bullet. If there are no more bullets available in the pool,
and the pool cannot be extended, then this method returns undefined
. It will also return undefined
if not enough time has expired since the last time the Weapon was fired,
@@ -468,7 +468,9 @@
If you wish to fire multiple bullets in a single game update, then set Weapon.multiFire = true
and you can call fire as many times as you like, per loop. Multiple fires in a single update
only counts once towards the shots total, but you will still receive an event for each bullet.
Optionally fires the bullet from the x and y properties of this object.
If set this overrides trackedSprite or trackedPointer. Pass null
to ignore it.
If the bullet is fired from a tracked Sprite or Pointer,
or the from
argument is set, this applies a vertical offset from the launch position.
The fired bullet, if a launch was successful, otherwise undefined
.
Fires a bullet at the given Pointer. The bullet will be launched from the fireFrom position, or from a Tracked Sprite or Pointer, if you have one set.
The Pointer to fire the bullet towards.
The fired bullet if successful, undefined otherwise.
-Fires a bullet at the given Sprite. The bullet will be launched from the fireFrom position, or from a Tracked Sprite or Pointer, if you have one set.
The Sprite to fire the bullet towards.
The fired bullet if successful, undefined otherwise.
-Fires a bullet at the given coordinates. The bullet will be launched from the fireFrom position, or from a Tracked Sprite or Pointer, if you have one set.
The y coordinate, in world space, to fire the bullet towards.
The fired bullet if successful, undefined otherwise.
-Attempts to fire multiple bullets from the positions defined in the given array.
If you provide a from
argument, or if there is a tracked Sprite or Pointer, then
the positions are treated as offsets from the given objects position.
An array containing all of the fired Bullet objects, if a launch was successful, otherwise an empty array.
-Attempts to fire a single Bullet from a tracked Sprite or Pointer, but applies an offset to the position first. This is the same as calling fire and passing in the offset arguments.
If there are no more bullets available in the pool, and the pool cannot be extended, @@ -541,7 +543,7 @@
The vertical offset from the position of the tracked Sprite or Pointer, as set with trackSprite.
The fired bullet, if a launch was successful, otherwise undefined
.
Call a function on each in-flight bullet in this Weapon.
See Set.each for more details.
Additional arguments to pass to the callback function, after the child item.
This Weapon instance.
-Calls Bullet.kill on every in-flight bullet in this Weapon. Also re-enables their physics bodies, should they have been disabled via pauseAll.
This Weapon instance.
@@ -590,12 +592,12 @@The listener function.
The context to invoke the listener with. Default this.
-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.
This Weapon instance.
-Internal postRender method, called by the Weapon Plugin. Used for instance when multiFire is enabled.
Only remove the listeners that have this context.
Only remove one-time listeners.
-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.
This Weapon instance.
-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 @@ -643,7 +645,7 @@
The Y offset of the Body from the top-left of the Sprites texture.
This Weapon instance.
-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.
@@ -662,7 +664,7 @@This Weapon instance.
Removes all listeners.
-Sets this Weapon to track the given Pointer. When a Weapon tracks a Pointer it will automatically update its fireFrom value to match the Pointer's position within the Game World, adjusting the coordinates based on the offset arguments.
@@ -677,7 +679,7 @@The vertical offset from the Pointers position to be applied to the Weapon.
This Weapon instance.
-Sets this Weapon to track the given Sprite, or any Object with x/y coords and optionally rotation When a Weapon tracks a Sprite it will automatically update its fireFrom value to match the Sprite's position within the Game World, adjusting the coordinates based on the offset arguments.
@@ -693,7 +695,7 @@Should the Weapon also track the Sprites rotation?
This Weapon instance.
-Internal update method, called by the Weapon Plugin. Used for updating weapon bounds and handling autofire.
Generated using TypeDoc