phaser/docs/Phaser.Weapon.html

7575 lines
134 KiB
HTML
Raw Normal View History

2016-06-17 00:11:24 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phaser Class: Weapon</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/default.css">
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-fixed-top navbar-inverse">
<div style="position: absolute; width: 143px; height: 31px; right: 10px; top: 10px; z-index: 1050"><a href="http://phaser.io"><img src="img/phaser.png" border="0" /></a></div>
<div class="navbar-inner">
<a class="brand" href="index.html">Phaser API</a>
<ul class="nav">
<li class="dropdown">
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-0">
<a href="Phaser.html">Phaser</a>
</li>
<li class="class-depth-0">
<a href="Phaser.KeyCode.html">KeyCode</a>
</li>
<li class="class-depth-0">
<a href="PIXI.html">PIXI</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1">
<a href="Phaser.Animation.html">Animation</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AnimationManager.html">AnimationManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AnimationParser.html">AnimationParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ArraySet.html">ArraySet</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ArrayUtils.html">ArrayUtils</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AudioSprite.html">AudioSprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.BitmapData.html">BitmapData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.BitmapText.html">BitmapText</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Bullet.html">Bullet</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Button.html">Button</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Cache.html">Cache</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Camera.html">Camera</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Canvas.html">Canvas</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Circle.html">Circle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Color.html">Color</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Angle.html">Angle</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Animation.html">Animation</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.AutoCull.html">AutoCull</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Bounds.html">Bounds</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.BringToTop.html">BringToTop</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Core.html">Core</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Crop.html">Crop</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Delta.html">Delta</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Destroy.html">Destroy</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.FixedToCamera.html">FixedToCamera</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Health.html">Health</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InCamera.html">InCamera</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InputEnabled.html">InputEnabled</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InWorld.html">InWorld</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.LifeSpan.html">LifeSpan</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.LoadTexture.html">LoadTexture</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Overlap.html">Overlap</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.PhysicsBody.html">PhysicsBody</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Reset.html">Reset</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.ScaleMinMax.html">ScaleMinMax</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Smoothed.html">Smoothed</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Create.html">Create</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Creature.html">Creature</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Device.html">Device</a>
</li>
<li class="class-depth-1">
<a href="Phaser.DeviceButton.html">DeviceButton</a>
</li>
<li class="class-depth-1">
<a href="Phaser.DOM.html">DOM</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Easing.html">Easing</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Back.html">Back</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Bounce.html">Bounce</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Circular.html">Circular</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Cubic.html">Cubic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Elastic.html">Elastic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Exponential.html">Exponential</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Linear.html">Linear</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quartic.html">Quartic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quintic.html">Quintic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Ellipse.html">Ellipse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Events.html">Events</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Filter.html">Filter</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FlexGrid.html">FlexGrid</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FlexLayer.html">FlexLayer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Frame.html">Frame</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FrameData.html">FrameData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Game.html">Game</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Gamepad.html">Gamepad</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Graphics.html">Graphics</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Group.html">Group</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Image.html">Image</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ImageCollection.html">ImageCollection</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Input.html">Input</a>
</li>
<li class="class-depth-1">
<a href="Phaser.InputHandler.html">InputHandler</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Key.html">Key</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Keyboard.html">Keyboard</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Line.html">Line</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LinkedList.html">LinkedList</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Loader.html">Loader</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LoaderParser.html">LoaderParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Math.html">Math</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Matrix.html">Matrix</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Mouse.html">Mouse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.MSPointer.html">MSPointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Net.html">Net</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particle.html">Particle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particles.html">Particles</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Particles.Arcade.html">Arcade</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Physics.html">Physics</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.Arcade.html">Arcade</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Arcade.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Arcade.TilemapCollision.html">TilemapCollision</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.Ninja.html">Ninja</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.AABB.html">AABB</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Circle.html">Circle</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Tile.html">Tile</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.P2.html">P2</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.DistanceConstraint.html">DistanceConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.FixtureList.html">FixtureList</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Material.html">Material</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.RevoluteConstraint.html">RevoluteConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.RotationalSpring.html">RotationalSpring</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Spring.html">Spring</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Plugin.html">Plugin</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PluginManager.html">PluginManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Point.html">Point</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Pointer.html">Pointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PointerMode.html">PointerMode</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Polygon.html">Polygon</a>
</li>
<li class="class-depth-1">
<a href="Phaser.QuadTree.html">QuadTree</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Rectangle.html">Rectangle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RenderTexture.html">RenderTexture</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RetroFont.html">RetroFont</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Rope.html">Rope</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RoundedRectangle.html">RoundedRectangle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ScaleManager.html">ScaleManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Signal.html">Signal</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SignalBinding.html">SignalBinding</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SinglePad.html">SinglePad</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Sound.html">Sound</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SoundManager.html">SoundManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Sprite.html">Sprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Stage.html">Stage</a>
</li>
<li class="class-depth-1">
<a href="Phaser.State.html">State</a>
</li>
<li class="class-depth-1">
<a href="Phaser.StateManager.html">StateManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Text.html">Text</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tile.html">Tile</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tilemap.html">Tilemap</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TilemapParser.html">TilemapParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tileset.html">Tileset</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TileSprite.html">TileSprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Time.html">Time</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Timer.html">Timer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TimerEvent.html">TimerEvent</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Touch.html">Touch</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tween.html">Tween</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TweenData.html">TweenData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TweenManager.html">TweenManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Utils.html">Utils</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Utils.Debug.html">Debug</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Video.html">Video</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Weapon.html">Weapon</a>
</li>
<li class="class-depth-1">
<a href="Phaser.World.html">World</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AbstractFilter.html">AbstractFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BaseTexture.html">BaseTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasBuffer.html">CanvasBuffer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasGraphics.html">CanvasGraphics</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasMaskManager.html">CanvasMaskManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasPool.html">CanvasPool</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasRenderer.html">CanvasRenderer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasTinter.html">CanvasTinter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ComplexPrimitiveShader.html">ComplexPrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DisplayObjectContainer.html">DisplayObjectContainer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.EarCut.html">EarCut</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Event.html">Event</a>
</li>
<li class="class-depth-1">
<a href="PIXI.EventTarget.html">EventTarget</a>
</li>
<li class="class-depth-1">
<a href="PIXI.FilterTexture.html">FilterTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Graphics.html">Graphics</a>
</li>
<li class="class-depth-1">
<a href="PIXI.GraphicsData.html">GraphicsData</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PIXI.html">PIXI</a>
</li>
2016-07-01 15:57:13 +00:00
<li class="class-depth-2">
<a href="PIXI.PIXI.DisplayObject.html">DisplayObject</a>
</li>
2016-06-17 00:11:24 +00:00
<li class="class-depth-1">
<a href="PIXI.PixiFastShader.html">PixiFastShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixiShader.html">PixiShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PolyK.html">PolyK</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PrimitiveShader.html">PrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.RenderTexture.html">RenderTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Rope.html">Rope</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Sprite.html">Sprite</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SpriteBatch.html">SpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Strip.html">Strip</a>
</li>
<li class="class-depth-1">
<a href="PIXI.StripShader.html">StripShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Texture.html">Texture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TilingSprite.html">TilingSprite</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLBlendModeManager.html">WebGLBlendModeManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLFastSpriteBatch.html">WebGLFastSpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLFilterManager.html">WebGLFilterManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLRenderer.html">WebGLRenderer</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-0">
<a href="global.html#ANGLE_DOWN">ANGLE_DOWN</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_LEFT">ANGLE_LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_NORTH_EAST">ANGLE_NORTH_EAST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_NORTH_WEST">ANGLE_NORTH_WEST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_RIGHT">ANGLE_RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_SOUTH_EAST">ANGLE_SOUTH_EAST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_SOUTH_WEST">ANGLE_SOUTH_WEST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_UP">ANGLE_UP</a>
</li>
<li class="class-depth-0">
<a href="global.html#AUTO">AUTO</a>
</li>
<li class="class-depth-0">
<a href="global.html#BITMAPDATA">BITMAPDATA</a>
</li>
<li class="class-depth-0">
<a href="global.html#BITMAPTEXT">BITMAPTEXT</a>
</li>
<li class="class-depth-0">
<a href="global.html#blendModes">blendModes</a>
</li>
<li class="class-depth-0">
<a href="global.html#BOTTOM_CENTER">BOTTOM_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#BOTTOM_LEFT">BOTTOM_LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#BOTTOM_RIGHT">BOTTOM_RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#BUTTON">BUTTON</a>
</li>
<li class="class-depth-0">
<a href="global.html#CANVAS">CANVAS</a>
</li>
<li class="class-depth-0">
<a href="global.html#CANVAS_FILTER">CANVAS_FILTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#CENTER">CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#CIRCLE">CIRCLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#CREATURE">CREATURE</a>
</li>
<li class="class-depth-0">
<a href="global.html#displayList">displayList</a>
</li>
<li class="class-depth-0">
<a href="global.html#DOWN">DOWN</a>
</li>
<li class="class-depth-0">
<a href="global.html#ELLIPSE">ELLIPSE</a>
</li>
<li class="class-depth-0">
<a href="global.html#EMITTER">EMITTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#GAMES">GAMES</a>
</li>
<li class="class-depth-0">
<a href="global.html#GRAPHICS">GRAPHICS</a>
</li>
<li class="class-depth-0">
<a href="global.html#GROUP">GROUP</a>
</li>
<li class="class-depth-0">
<a href="global.html#HEADLESS">HEADLESS</a>
</li>
<li class="class-depth-0">
<a href="global.html#HORIZONTAL">HORIZONTAL</a>
</li>
<li class="class-depth-0">
<a href="global.html#IMAGE">IMAGE</a>
</li>
<li class="class-depth-0">
<a href="global.html#intersectsRectangle">intersectsRectangle</a>
</li>
<li class="class-depth-0">
<a href="global.html#LANDSCAPE">LANDSCAPE</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT">LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT_BOTTOM">LEFT_BOTTOM</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT_CENTER">LEFT_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT_TOP">LEFT_TOP</a>
</li>
<li class="class-depth-0">
<a href="global.html#LINE">LINE</a>
</li>
<li class="class-depth-0">
<a href="global.html#MATRIX">MATRIX</a>
</li>
<li class="class-depth-0">
<a href="global.html#NONE">NONE</a>
</li>
<li class="class-depth-0">
<a href="global.html#PENDING_ATLAS">PENDING_ATLAS</a>
</li>
<li class="class-depth-0">
<a href="global.html#POINT">POINT</a>
</li>
<li class="class-depth-0">
<a href="global.html#POINTER">POINTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#POLYGON">POLYGON</a>
</li>
<li class="class-depth-0">
<a href="global.html#PORTRAIT">PORTRAIT</a>
</li>
<li class="class-depth-0">
<a href="global.html#RECTANGLE">RECTANGLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#RENDERTEXTURE">RENDERTEXTURE</a>
</li>
<li class="class-depth-0">
<a href="global.html#RETROFONT">RETROFONT</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT">RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT_BOTTOM">RIGHT_BOTTOM</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT_CENTER">RIGHT_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT_TOP">RIGHT_TOP</a>
</li>
<li class="class-depth-0">
<a href="global.html#ROPE">ROPE</a>
</li>
<li class="class-depth-0">
<a href="global.html#ROUNDEDRECTANGLE">ROUNDEDRECTANGLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#scaleModes">scaleModes</a>
</li>
<li class="class-depth-0">
<a href="global.html#SPRITE">SPRITE</a>
</li>
<li class="class-depth-0">
<a href="global.html#SPRITEBATCH">SPRITEBATCH</a>
</li>
<li class="class-depth-0">
<a href="global.html#TEXT">TEXT</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILEMAP">TILEMAP</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILEMAPLAYER">TILEMAPLAYER</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILESPRITE">TILESPRITE</a>
</li>
<li class="class-depth-0">
<a href="global.html#TOP_CENTER">TOP_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#TOP_LEFT">TOP_LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#TOP_RIGHT">TOP_RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#UP">UP</a>
</li>
<li class="class-depth-0">
<a href="global.html#VERSION">VERSION</a>
</li>
<li class="class-depth-0">
<a href="global.html#VERTICAL">VERTICAL</a>
</li>
<li class="class-depth-0">
<a href="global.html#VIDEO">VIDEO</a>
</li>
<li class="class-depth-0">
<a href="global.html#WEBGL">WEBGL</a>
</li>
<li class="class-depth-0">
<a href="global.html#WEBGL_FILTER">WEBGL_FILTER</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Core<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Game.html">Game</a></li>
<li class="class-depth-1"><a href="Phaser.Group.html">Group</a></li>
<li class="class-depth-1"><a href="Phaser.World.html">World</a></li>
<li class="class-depth-1"><a href="Phaser.Loader.html">Loader</a></li>
<li class="class-depth-1"><a href="Phaser.Cache.html">Cache</a></li>
<li class="class-depth-1"><a href="Phaser.Time.html">Time</a></li>
<li class="class-depth-1"><a href="Phaser.Camera.html">Camera</a></li>
<li class="class-depth-1"><a href="Phaser.StateManager.html">State Manager</a></li>
<li class="class-depth-1"><a href="Phaser.TweenManager.html">Tween Manager</a></li>
<li class="class-depth-1"><a href="Phaser.SoundManager.html">Sound Manager</a></li>
<li class="class-depth-1"><a href="Phaser.Input.html">Input Manager</a></li>
<li class="class-depth-1"><a href="Phaser.ScaleManager.html">Scale Manager</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Game Objects<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.GameObjectFactory.html">Factory (game.add)</a></li>
<li class="class-depth-1"><a href="Phaser.GameObjectCreator.html">Creator (game.make)</a></li>
<li class="class-depth-1"><a href="Phaser.Sprite.html">Sprite</a></li>
<li class="class-depth-1"><a href="Phaser.Image.html">Image</a></li>
<li class="class-depth-1"><a href="Phaser.Sound.html">Sound</a></li>
<li class="class-depth-1"><a href="Phaser.Video.html">Video</a></li>
<li class="class-depth-1"><a href="Phaser.Particles.Arcade.Emitter.html">Particle Emitter</a></li>
<li class="class-depth-1"><a href="Phaser.Particle.html">Particle</a></li>
<li class="class-depth-1"><a href="Phaser.Text.html">Text</a></li>
<li class="class-depth-1"><a href="Phaser.Tween.html">Tween</a></li>
<li class="class-depth-1"><a href="Phaser.BitmapText.html">BitmapText</a></li>
<li class="class-depth-1"><a href="Phaser.Tilemap.html">Tilemap</a></li>
<li class="class-depth-1"><a href="Phaser.BitmapData.html">BitmapData</a></li>
<li class="class-depth-1"><a href="Phaser.RetroFont.html">RetroFont</a></li>
<li class="class-depth-1"><a href="Phaser.Button.html">Button</a></li>
<li class="class-depth-1"><a href="Phaser.Animation.html">Animation</a></li>
<li class="class-depth-1"><a href="Phaser.Graphics.html">Graphics</a></li>
<li class="class-depth-1"><a href="Phaser.RenderTexture.html">RenderTexture</a></li>
<li class="class-depth-1"><a href="Phaser.TileSprite.html">TileSprite</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Geometry<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Circle.html">Circle</a></li>
<li class="class-depth-1"><a href="Phaser.Ellipse.html">Ellipse</a></li>
<li class="class-depth-1"><a href="Phaser.Line.html">Line</a></li>
<li class="class-depth-1"><a href="Phaser.Matrix.html">Matrix</a></li>
<li class="class-depth-1"><a href="Phaser.Point.html">Point</a></li>
<li class="class-depth-1"><a href="Phaser.Polygon.html">Polygon</a></li>
<li class="class-depth-1"><a href="Phaser.Rectangle.html">Rectangle</a></li>
<li class="class-depth-1"><a href="Phaser.RoundedRectangle.html">Rounded Rectangle</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Physics<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Physics.Arcade.html">Arcade Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.Arcade.Body.html">Body</a></li>
<li class="class-depth-2"><a href="Phaser.Weapon.html">Weapon</a></li>
<li class="class-depth-1"><a href="Phaser.Physics.P2.html">P2 Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.Body.html">Body</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.Spring.html">Spring</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a></li>
<li class="class-depth-1"><a href="Phaser.Physics.Ninja.html">Ninja Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.Body.html">Body</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Input<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.InputHandler.html">Input Handler</a></li>
<li class="class-depth-1"><a href="Phaser.Pointer.html">Pointer</a></li>
<li class="class-depth-1"><a href="Phaser.DeviceButton.html">Device Button</a></li>
<li class="class-depth-1"><a href="Phaser.Mouse.html">Mouse</a></li>
<li class="class-depth-1"><a href="Phaser.Keyboard.html">Keyboard</a></li>
<li class="class-depth-1"><a href="Phaser.Key.html">Key</a></li>
<li class="class-depth-1"><a href="Phaser.Gamepad.html">Gamepad</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="http://phaser.io">Phaser Web Site</a></li>
<li class="class-depth-1"><a href="https://github.com/photonstorm/phaser">Phaser Github</a></li>
<li class="class-depth-1"><a href="http://phaser.io/examples">Phaser Examples</a></li>
<li class="class-depth-1"><a href="https://github.com/photonstorm/phaser-plugins">Phaser Plugins</a></li>
<li class="class-depth-1"><a href="http://www.html5gamedevs.com/forum/14-phaser/">Forum</a></li>
<li class="class-depth-1"><a href="http://stackoverflow.com/questions/tagged/phaser-framework">Stack Overflow</a></li>
<li class="class-depth-1"><a href="http://phaser.io/learn">Tutorials</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/newsletter">Newsletter</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/twitter">Twitter</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/slack">Slack</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/donate">Donate</a></li>
<li class="class-depth-1"><a href="https://www.codeandweb.com/texturepacker/phaser">Texture Packer</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<div id="main">
<!--<h1 class="page-title">Class: Weapon</h1>-->
<section>
<header>
<h2>
<span class="ancestors"><a href="Phaser.html">Phaser</a>.</span>
Weapon
</h2>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name "
id="Weapon"><span class="type-signature"></span>new Weapon<span class="signature">(game, parent)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>The Weapon Plugin provides the ability to easily create a bullet pool and manager.</p>
<p>Weapons fire Phaser.Bullet objects, which are essentially Sprites with a few extra properties.
The Bullets are enabled for Arcade Physics. They do not currently work with P2 Physics.</p>
<p>The Bullets are created inside of <code>Weapon.bullets</code>, which is a Phaser.Group instance. Anything you
can usually do with a Group, such as move it around the display list, iterate it, etc can be done
to the bullets Group too.</p>
<p>Bullets can have textures and even animations. You can control the speed at which they are fired,
the firing rate, the firing angle, and even set things like gravity for them.</p>
<p>A small example, assumed to be running from within a Phaser.State create method.</p>
<p><code>var weapon = this.add.weapon(10, 'bullet');</code>
<code>weapon.fireFrom.set(300, 300);</code>
<code>this.input.onDown.add(weapon.fire, this);</code></p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>game</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Game.html">Phaser.Game</a></span>
</td>
<td class="description last"><p>A reference to the current Phaser.Game instance.</p></td>
</tr>
<tr>
<td class="name"><code>parent</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.PluginManager.html">Phaser.PluginManager</a></span>
</td>
<td class="description last"><p>The Phaser Plugin Manager which looks after this plugin.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-31">line 31</a>
</dt>
</dl>
</dd>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<dt>
<h4 class="name "
id=".KILL_CAMERA_BOUNDS"><span class="type-signature">&lt;static, constant> </span>KILL_CAMERA_BOUNDS<span class="type-signature"> :integer</span></h4>
</dt>
<dd>
<div class="description">
<p>A <code>bulletKillType</code> constant that automatically kills the bullets when they leave the <code>Camera.bounds</code> rectangle.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-409">line 409</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id=".KILL_DISTANCE"><span class="type-signature">&lt;static, constant> </span>KILL_DISTANCE<span class="type-signature"> :integer</span></h4>
</dt>
<dd>
<div class="description">
2016-07-01 15:57:13 +00:00
<p>A <code>bulletKillType</code> constant that automatically kills the bullets after they
2016-06-17 00:11:24 +00:00
exceed the <code>bulletDistance</code> from their original firing position.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-395">line 395</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id=".KILL_LIFESPAN"><span class="type-signature">&lt;static, constant> </span>KILL_LIFESPAN<span class="type-signature"> :integer</span></h4>
</dt>
<dd>
<div class="description">
<p>A <code>bulletKillType</code> constant that automatically kills the bullets when their <code>bulletLifespan</code> expires.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-387">line 387</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id=".KILL_NEVER"><span class="type-signature">&lt;static, constant> </span>KILL_NEVER<span class="type-signature"> :integer</span></h4>
</dt>
<dd>
<div class="description">
<p>A <code>bulletKillType</code> constant that stops the bullets from ever being destroyed automatically.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-380">line 380</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id=".KILL_STATIC_BOUNDS"><span class="type-signature">&lt;static, constant> </span>KILL_STATIC_BOUNDS<span class="type-signature"> :integer</span></h4>
</dt>
<dd>
<div class="description">
<p>A <code>bulletKillType</code> constant that automatically kills the bullets when they leave the <code>Weapon.bounds</code> rectangle.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-423">line 423</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id=".KILL_WEAPON_BOUNDS"><span class="type-signature">&lt;static, constant> </span>KILL_WEAPON_BOUNDS<span class="type-signature"> :integer</span></h4>
</dt>
<dd>
<div class="description">
<p>A <code>bulletKillType</code> constant that automatically kills the bullets when they leave the <code>Weapon.bounds</code> rectangle.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-402">line 402</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id=".KILL_WORLD_BOUNDS"><span class="type-signature">&lt;static, constant> </span>KILL_WORLD_BOUNDS<span class="type-signature"> :integer</span></h4>
</dt>
<dd>
<div class="description">
<p>A <code>bulletKillType</code> constant that automatically kills the bullets when they leave the <code>World.bounds</code> rectangle.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-416">line 416</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="autoExpandBulletsGroup"><span class="type-signature"></span>autoExpandBulletsGroup<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>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.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-46">line 46</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="autofire"><span class="type-signature"></span>autofire<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>Will this weapon auto fire? If set to true then a new bullet will be fired
based on the <code>fireRate</code> value.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-53">line 53</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bounds"><span class="type-signature"></span>bounds<span class="type-signature"> :<a href="Phaser.Rectangle.html">Phaser.Rectangle</a></span></h4>
</dt>
<dd>
<div class="description">
<p>This Rectangle defines the bounds that are used when determining if a Bullet should be killed or not.
It's used in combination with <code>Weapon.bulletKillType</code> when that is set to either <code>Phaser.Weapon.KILL_WEAPON_BOUNDS</code>
or <code>Phaser.Weapon.KILL_STATIC_BOUNDS</code>. 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.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-266">line 266</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletAngleOffset"><span class="type-signature"></span>bulletAngleOffset<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>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.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-153">line 153</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletAngleVariance"><span class="type-signature"></span>bulletAngleVariance<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>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 <code>bulletAngleVariance</code> 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.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-162">line 162</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletAnimation"><span class="type-signature"></span>bulletAnimation<span class="type-signature"> :string</span></h4>
</dt>
<dd>
<div class="description">
<p>The string based name of the animation that the Bullet will be given on launch.
This is set via <code>Weapon.addBulletAnimation</code>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-112">line 112</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletClass"><span class="type-signature"></span>bulletClass<span class="type-signature"> :Object</span></h4>
</dt>
<dd>
<div class="description">
<p>The Class of the bullets that are launched by this Weapon. Defaults <code>Phaser.Bullet</code>, but can be
overridden before calling <code>createBullets</code> and set to your own class type.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-1070">line 1070</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletCollideWorldBounds"><span class="type-signature"></span>bulletCollideWorldBounds<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>Should bullets collide with the World bounds or not?</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-1158">line 1158</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletFrame"><span class="type-signature"></span>bulletFrame<span class="type-signature"> :string|integer</span></h4>
</dt>
<dd>
<div class="description">
<p>The Texture Frame that the Bullets use when rendering.
Changing this has no effect on bullets in-flight, only on newly spawned bullets.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
|
<span class="param-type">integer</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-221">line 221</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletFrameCycle"><span class="type-signature"></span>bulletFrameCycle<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>If you've added a set of frames via <code>Weapon.setBulletFrames</code> 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.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-129">line 129</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletFrameRandom"><span class="type-signature"></span>bulletFrameRandom<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>If you've added a set of frames via <code>Weapon.setBulletFrames</code> then you can optionally
chose for each Bullet fired to pick a random frame from the set.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-119">line 119</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletFrames"><span class="type-signature">&lt;internal> </span>bulletFrames<span class="type-signature"> :Array</span></h4>
</dt>
<dd>
<div class="description">
<p>This array stores the frames added via <code>Weapon.setBulletFrames</code>.</p>
</div>
<dl class="details">
<dt class="important tag-deprecated">Internal:</dt>
<dd class="tag-deprecated"><ul>
<li>This member is <em>internal (protected)</em> and may be modified or removed in the future.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-282">line 282</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletGravity"><span class="type-signature"></span>bulletGravity<span class="type-signature"> :<a href="Phaser.Point.html">Phaser.Point</a></span></h4>
</dt>
<dd>
<div class="description">
<p>This is the amount of gravity added to the Bullets physics body when fired.
Gravity is expressed in pixels / second / second.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-199">line 199</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletInheritSpriteSpeed"><span class="type-signature"></span>bulletInheritSpriteSpeed<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>When a Bullet is fired it can optionally inherit the velocity of the <code>trackedSprite</code> if set.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-105">line 105</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletKey"><span class="type-signature"></span>bulletKey<span class="type-signature"> :string</span></h4>
</dt>
<dd>
<div class="description">
<p>The Texture Key that the Bullets use when rendering.
Changing this has no effect on bullets in-flight, only on newly spawned bullets.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-214">line 214</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletKillDistance"><span class="type-signature"></span>bulletKillDistance<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
2016-07-01 15:57:13 +00:00
<p>If you've set <code>bulletKillType</code> to <code>Phaser.Weapon.KILL_DISTANCE</code> this controls the distance
2016-06-17 00:11:24 +00:00
the Bullet can travel before it is automatically killed. The distance is given in pixels.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-192">line 192</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletKillType"><span class="type-signature"></span>bulletKillType<span class="type-signature"> :integer</span></h4>
</dt>
<dd>
<div class="description">
<p>This controls how the bullets will be killed. The default is <code>Phaser.Weapon.KILL_WORLD_BOUNDS</code>.</p>
<p>There are 7 different &quot;kill types&quot; available:</p>
<ul>
<li><p><code>Phaser.Weapon.KILL_NEVER</code>
The bullets are never destroyed by the Weapon. It's up to you to destroy them via your own code.</p>
</li>
<li><p><code>Phaser.Weapon.KILL_LIFESPAN</code>
The bullets are automatically killed when their <code>bulletLifespan</code> amount expires.</p>
</li>
<li><p><code>Phaser.Weapon.KILL_DISTANCE</code>
The bullets are automatically killed when they exceed <code>bulletDistance</code> pixels away from their original launch position.</p>
</li>
<li><p><code>Phaser.Weapon.KILL_WEAPON_BOUNDS</code>
The bullets are automatically killed when they no longer intersect with the <code>Weapon.bounds</code> rectangle.</p>
</li>
<li><p><code>Phaser.Weapon.KILL_CAMERA_BOUNDS</code>
The bullets are automatically killed when they no longer intersect with the <code>Camera.bounds</code> rectangle.</p>
</li>
<li><p><code>Phaser.Weapon.KILL_WORLD_BOUNDS</code>
The bullets are automatically killed when they no longer intersect with the <code>World.bounds</code> rectangle.</p>
</li>
<li><p><code>Phaser.Weapon.KILL_STATIC_BOUNDS</code>
The bullets are automatically killed when they no longer intersect with the <code>Weapon.bounds</code> rectangle.
The difference between static bounds and weapon bounds, is that a static bounds will never be adjusted to
match the position of a tracked sprite or pointer.</p>
</li>
</ul>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-1095">line 1095</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletLifespan"><span class="type-signature"></span>bulletLifespan<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
2016-07-01 15:57:13 +00:00
<p>If you've set <code>bulletKillType</code> to <code>Phaser.Weapon.KILL_LIFESPAN</code> this controls the amount
2016-06-17 00:11:24 +00:00
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.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-185">line 185</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletRotateToVelocity"><span class="type-signature"></span>bulletRotateToVelocity<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>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 <code>bulletGravity</code>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-207">line 207</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bullets"><span class="type-signature"></span>bullets<span class="type-signature"> :<a href="Phaser.Group.html">Phaser.Group</a></span></h4>
</dt>
<dd>
<div class="description">
<p>This is the Phaser.Group that contains all of the bullets managed by this plugin.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-39">line 39</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletSpeed"><span class="type-signature"></span>bulletSpeed<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The speed at which the bullets are fired. This value is given in pixels per second, and
is used to set the starting velocity of the bullets.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-169">line 169</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletSpeedVariance"><span class="type-signature"></span>bulletSpeedVariance<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>This is a variance added to the speed of Bullets when they are fired.
2016-07-01 15:57:13 +00:00
If bullets have a <code>bulletSpeed</code> value of 200, and a <code>bulletSpeedVariance</code> of 50
2016-06-17 00:11:24 +00:00
then the actual speed of the Bullets will be between 150 and 250 pixels per second.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-177">line 177</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletWorldWrap"><span class="type-signature"></span>bulletWorldWrap<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>Should the Bullets wrap around the world bounds? This automatically calls
<code>World.wrap</code> on the Bullet each frame. See the docs for that method for details.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-136">line 136</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bulletWorldWrapPadding"><span class="type-signature"></span>bulletWorldWrapPadding<span class="type-signature"> :integer</span></h4>
</dt>
<dd>
<div class="description">
<p>If <code>bulletWorldWrap</code> 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.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-144">line 144</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="fireAngle"><span class="type-signature"></span>fireAngle<span class="type-signature"> :integer</span></h4>
</dt>
<dd>
<div class="description">
2016-07-01 15:57:13 +00:00
<p>The angle at which the bullets are fired. This can be a const such as Phaser.ANGLE_UP
2016-06-17 00:11:24 +00:00
or it can be any number from 0 to 360 inclusive, where 0 degrees is to the right.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-99">line 99</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="fireFrom"><span class="type-signature"></span>fireFrom<span class="type-signature"> :<a href="Phaser.Rectangle.html">Phaser.Rectangle</a></span></h4>
</dt>
<dd>
<div class="description">
<p>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.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-92">line 92</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="fireLimit"><span class="type-signature"></span>fireLimit<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The maximum number of shots that this Weapon is allowed to fire before it stops.
When the limit is his the <code>Weapon.onFireLimit</code> Signal is dispatched.
You can reset the shot counter via <code>Weapon.resetShots</code>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-69">line 69</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="fireRate"><span class="type-signature"></span>fireRate<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The rate at which this Weapon can fire. The value is given in milliseconds.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-75">line 75</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="fireRateVariance"><span class="type-signature"></span>fireRateVariance<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>This is a modifier that is added to the <code>fireRate</code> each update to add variety
to the firing rate of the Weapon. The value is given in milliseconds.
If you've a <code>fireRate</code> of 200 and a <code>fireRateVariance</code> of 50 then the actual
firing rate of the Weapon will be between 150 and 250.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-84">line 84</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="onFire"><span class="type-signature"></span>onFire<span class="type-signature"> :<a href="Phaser.Signal.html">Phaser.Signal</a></span></h4>
</dt>
<dd>
<div class="description">
<p>The onFire Signal is dispatched each time <code>Weapon.fire</code> is called, and a Bullet is
2016-07-01 15:57:13 +00:00
<em>successfully</em> launched. The callback is set two arguments: a reference to the bullet sprite itself,
and a reference to the Weapon that fired the bullet.</p>
2016-06-17 00:11:24 +00:00
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-306">line 306</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="onFireLimit"><span class="type-signature"></span>onFireLimit<span class="type-signature"> :<a href="Phaser.Signal.html">Phaser.Signal</a></span></h4>
</dt>
<dd>
<div class="description">
<p>The onFireLimit Signal is dispatched if <code>Weapon.fireLimit</code> is &gt; 0, and a bullet launch takes the number
of shots fired to equal the fire limit.
The callback is sent two arguments: A reference to the Weapon that hit the limit, and the value of
<code>Weapon.fireLimit</code>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-325">line 325</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="onKill"><span class="type-signature"></span>onKill<span class="type-signature"> :<a href="Phaser.Signal.html">Phaser.Signal</a></span></h4>
</dt>
<dd>
<div class="description">
<p>The onKill Signal is dispatched each time a Bullet that is in-flight is killed. This can be the result
of leaving the Weapon bounds, an expiring lifespan, or exceeding a specified distance.
The callback is sent one argument: A reference to the bullet sprite itself.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-315">line 315</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="shots"><span class="type-signature"></span>shots<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The total number of bullets this Weapon has fired so far.
You can limit the number of shots allowed (via <code>fireLimit</code>), and reset
this total via <code>Weapon.resetShots</code>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-61">line 61</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="trackedPointer"><span class="type-signature"></span>trackedPointer<span class="type-signature"> :<a href="Phaser.Pointer.html">Phaser.Pointer</a></span></h4>
</dt>
<dd>
<div class="description">
<p>The Pointer currently being tracked by the Weapon, if any.
This is set via the <code>Weapon.trackPointer</code> method.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-341">line 341</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="trackedSprite"><span class="type-signature"></span>trackedSprite<span class="type-signature"> :<a href="Phaser.Sprite.html">Phaser.Sprite</a>|Object</span></h4>
</dt>
<dd>
<div class="description">
<p>The Sprite currently being tracked by the Weapon, if any.
This is set via the <code>Weapon.trackSprite</code> method.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type">Object</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-333">line 333</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="trackOffset"><span class="type-signature"></span>trackOffset<span class="type-signature"> :<a href="Phaser.Point.html">Phaser.Point</a></span></h4>
</dt>
<dd>
<div class="description">
<p>The Track Offset is a Point 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 <code>trackOffset.x = 16</code> to have
the bullet launched from the center of the Sprite.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-360">line 360</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="trackRotation"><span class="type-signature"></span>trackRotation<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>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.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-350">line 350</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="x"><span class="type-signature"></span>x<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The x coordinate from which bullets are fired. This is the same as <code>Weapon.fireFrom.x</code>, and
can be overridden by the <code>Weapon.fire</code> arguments.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-1183">line 1183</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="y"><span class="type-signature"></span>y<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The y coordinate from which bullets are fired. This is the same as <code>Weapon.fireFrom.y</code>, and
can be overridden by the <code>Weapon.fire</code> arguments.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-1205">line 1205</a>
</dt>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name "
id="addBulletAnimation"><span class="type-signature"></span>addBulletAnimation<span class="signature">(name, <span class="optional">frames</span>, <span class="optional">frameRate</span>, <span class="optional">loop</span>, <span class="optional">useNumericIndex</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a new animation under the given key. Optionally set the frames, frame rate and loop.
The arguments are all the same as for <code>Animation.add</code>, and work in the same way.</p>
<p><code>Weapon.bulletAnimation</code> will be set to this animation after it's created. From that point on, all
bullets fired will play using this animation. You can swap between animations by calling this method
several times, and then just changing the <code>Weapon.bulletAnimation</code> property to the name of the animation
you wish to play for the next launched bullet.</p>
<p>If you wish to stop using animations at all, set <code>Weapon.bulletAnimation</code> to '' (an empty string).</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The unique (within the Weapon instance) name for the animation, i.e. &quot;fire&quot;, &quot;blast&quot;.</p></td>
</tr>
<tr>
<td class="name"><code>frames</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last"><p>An array of numbers/strings that correspond to the frames to add to this animation and in which order. e.g. [1, 2, 3] or ['run0', 'run1', run2]). If null then all frames will be used.</p></td>
</tr>
<tr>
<td class="name"><code>frameRate</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The speed at which the animation should play. The speed is given in frames per second.</p></td>
</tr>
<tr>
<td class="name"><code>loop</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Whether or not the animation is looped or just plays once.</p></td>
</tr>
<tr>
<td class="name"><code>useNumericIndex</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>Are the given frames using numeric indexes (default) or strings?</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>The Weapon Plugin.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-1007">line 1007</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="createBullets"><span class="type-signature"></span>createBullets<span class="signature">(<span class="optional">quantity</span>, <span class="optional">key</span>, <span class="optional">frame</span>, <span class="optional">group</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>This method performs two actions: First it will check to see if the <code>Weapon.bullets</code> Group exists or not,
and if not it creates it, adding it the <code>group</code> given as the 4th argument.</p>
<p>Then it will seed the bullet pool with the <code>quantity</code> number of Bullets, using the texture key and frame
provided (if any).</p>
<p>If for example you set the quantity to be 10, then this Weapon will only ever be able to have 10 bullets
in-flight simultaneously. If you try to fire an 11th bullet then nothing will happen until one, or more, of
the in-flight bullets have been killed, freeing them up for use by the Weapon again.</p>
<p>If you do not wish to have a limit set, then pass in -1 as the quantity. In this instance the Weapon will
keep increasing the size of the bullet pool as needed. It will never reduce the size of the pool however,
so be careful it doesn't grow too large.</p>
<p>You can either set the texture key and frame here, or via the <code>Weapon.bulletKey</code> and <code>Weapon.bulletFrame</code>
2016-07-01 15:57:13 +00:00
properties. You can also animate bullets, or set them to use random frames. All Bullets belonging to a
2016-06-17 00:11:24 +00:00
single Weapon instance must share the same texture key however.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>quantity</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
1
</td>
<td class="description last"><p>The quantity of bullets to seed the Weapon with. If -1 it will set the pool to automatically expand.</p></td>
</tr>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The Game.cache key of the image that this Sprite will use.</p></td>
</tr>
<tr>
<td class="name"><code>frame</code></td>
<td class="type">
<span class="param-type">integer</span>
|
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>If the Sprite image contains multiple frames you can specify which one to use here.</p></td>
</tr>
<tr>
<td class="name"><code>group</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Group.html">Phaser.Group</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>Optional Group to add the object to. If not specified it will be added to the World group.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>This Weapon instance.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-425">line 425</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="debug"><span class="type-signature"></span>debug<span class="signature">(<span class="optional">x</span>, <span class="optional">y</span>, <span class="optional">debugBodies</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Uses <code>Game.Debug</code> to draw some useful information about this Weapon, including the number of bullets
both in-flight, and available. And optionally the physics debug bodies of the bullets.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
16
</td>
<td class="description last"><p>The coordinate, in screen space, at which to draw the Weapon debug data.</p></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
32
</td>
<td class="description last"><p>The coordinate, in screen space, at which to draw the Weapon debug data.</p></td>
</tr>
<tr>
<td class="name"><code>debugBodies</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Optionally draw the physics body of every bullet in-flight.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-1045">line 1045</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="destroy"><span class="type-signature"></span>destroy<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Destroys this Weapon. It removes itself from the PluginManager, destroys
the bullets Group, and nulls internal references.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-571">line 571</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="fire"><span class="type-signature"></span>fire<span class="signature">(<span class="optional">from</span>, <span class="optional">x</span>, <span class="optional">y</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>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 <code>false</code>. It will also return false if not enough time has expired since the last time
the Weapon was fired, as defined in the <code>Weapon.fireRate</code> property.</p>
<p>Otherwise the first available bullet is selected and launched.</p>
<p>The arguments are all optional, but allow you to control both where the bullet is launched from, and aimed at.</p>
<p>If you don't provide any of the arguments then it uses those set via properties such as <code>Weapon.trackedSprite</code>,
<code>Weapon.bulletAngle</code> and so on.</p>
<p>When the bullet is launched it has its texture and frame updated, as required. The velocity of the bullet is
calculated based on Weapon properties like <code>bulletSpeed</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>from</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span>
|
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Optionally fires the bullet <strong>from</strong> the <code>x</code> and <code>y</code> properties of this object. If set this overrides <code>Weapon.trackedSprite</code> or <code>trackedPointer</code>. Pass <code>null</code> to ignore it.</p></td>
</tr>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The x coordinate, in world space, to fire the bullet <strong>towards</strong>. If left as <code>undefined</code> the bullet direction is based on its angle.</p></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The y coordinate, in world space, to fire the bullet <strong>towards</strong>. If left as <code>undefined</code> the bullet direction is based on its angle.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">boolean</span>
-
</div>
<div class="returns-desc param-desc">
<p>True if a bullet was successfully fired, otherwise false.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-683">line 683</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="fireAtPointer"><span class="type-signature"></span>fireAtPointer<span class="signature">(<span class="optional">pointer</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Fires a bullet <strong>at</strong> the given Pointer. The bullet will be launched from the <code>Weapon.fireFrom</code> position,
or from a Tracked Sprite or Pointer, if you have one set.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>pointer</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Pointer.html">Phaser.Pointer</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The Pointer to fire the bullet towards.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">boolean</span>
-
</div>
<div class="returns-desc param-desc">
<p>True if a bullet was successfully fired, otherwise false.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-887">line 887</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="fireAtSprite"><span class="type-signature"></span>fireAtSprite<span class="signature">(<span class="optional">sprite</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Fires a bullet <strong>at</strong> the given Sprite. The bullet will be launched from the <code>Weapon.fireFrom</code> position,
or from a Tracked Sprite or Pointer, if you have one set.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>sprite</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The Sprite to fire the bullet towards.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">boolean</span>
-
</div>
<div class="returns-desc param-desc">
<p>True if a bullet was successfully fired, otherwise false.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-903">line 903</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="fireAtXY"><span class="type-signature"></span>fireAtXY<span class="signature">(<span class="optional">x</span>, <span class="optional">y</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Fires a bullet <strong>at</strong> the given coordinates. The bullet will be launched from the <code>Weapon.fireFrom</code> position,
or from a Tracked Sprite or Pointer, if you have one set.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The x coordinate, in world space, to fire the bullet towards.</p></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The y coordinate, in world space, to fire the bullet towards.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">boolean</span>
-
</div>
<div class="returns-desc param-desc">
<p>True if a bullet was successfully fired, otherwise false.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-917">line 917</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="forEach"><span class="type-signature"></span>forEach<span class="signature">(callback, callbackContext, <span class="optional">args</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Call a function on each in-flight bullet in this Weapon.</p>
<p>See <a href="Phaser.Group.html#forEachExists">forEachExists</a> for more details.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The function that will be called for each applicable child. The child will be passed as the first argument.</p></td>
</tr>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The context in which the function should be called (usually 'this').</p></td>
</tr>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
&lt;optional><br>
&lt;repeatable><br>
</td>
<td class="default">
(none)
</td>
<td class="description last"><p>Additional arguments to pass to the callback function, after the child item.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>This Weapon instance.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-482">line 482</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="killAll"><span class="type-signature"></span>killAll<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Calls <code>Bullet.kill</code> on every in-flight bullet in this Weapon.
Also re-enables their physics bodies, should they have been disabled via <code>pauseAll</code>.</p>
</div>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>This Weapon instance.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-533">line 533</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="pauseAll"><span class="type-signature"></span>pauseAll<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Sets <code>Body.enable</code> to <code>false</code> 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.</p>
</div>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>This Weapon instance.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-501">line 501</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="resetShots"><span class="type-signature"></span>resetShots<span class="signature">(<span class="optional">newLimit</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Resets the <code>Weapon.shots</code> counter back to zero. This is used when you've set
<code>Weapon.fireLimit</code>, and have hit (or just wish to reset) your limit.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>newLimit</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Optionally set a new <code>Weapon.fireLimit</code>.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>This Weapon instance.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-550">line 550</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="resumeAll"><span class="type-signature"></span>resumeAll<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Sets <code>Body.enable</code> to <code>true</code> 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.</p>
</div>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>This Weapon instance.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-517">line 517</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="setBulletBodyOffset"><span class="type-signature"></span>setBulletBodyOffset<span class="signature">(width, height, <span class="optional">offsetX</span>, <span class="optional">offsetY</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>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 <em>texture</em>.</p>
<p>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:</p>
<p><code>setSize(32, 32, 24, 34)</code></p>
<p>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.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The width of the Body.</p></td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The height of the Body.</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The X offset of the Body from the top-left of the Sprites texture.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The Y offset of the Body from the top-left of the Sprites texture.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>The Weapon Plugin.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-932">line 932</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="setBulletFrames"><span class="type-signature"></span>setBulletFrames<span class="signature">(min, max, <span class="optional">cycle</span>, <span class="optional">random</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Sets the texture frames that the bullets can use when being launched.</p>
<p>This is intended for use when you've got numeric based frames, such as those loaded via a Sprite Sheet.</p>
<p>It works by calling <code>Phaser.ArrayUtils.numberArray</code> internally, using the min and max values
provided. Then it sets the frame index to be zero.</p>
<p>You can optionally set the cycle and random booleans, to allow bullets to cycle through the frames
when they're fired, or pick one at random.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>min</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The minimum value the frame can be. Usually zero.</p></td>
</tr>
<tr>
<td class="name"><code>max</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The maximum value the frame can be.</p></td>
</tr>
<tr>
<td class="name"><code>cycle</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>Should the bullet frames cycle as they are fired?</p></td>
</tr>
<tr>
<td class="name"><code>random</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Should the bullet frames be picked at random as they are fired?</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>The Weapon Plugin.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-973">line 973</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="trackPointer"><span class="type-signature"></span>trackPointer<span class="signature">(<span class="optional">pointer</span>, <span class="optional">offsetX</span>, <span class="optional">offsetY</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Sets this Weapon to track the given Pointer.
When a Weapon tracks a Pointer it will automatically update its <code>fireFrom</code> value to match the Pointers
position within the Game World, adjusting the coordinates based on the offset arguments.</p>
<p>This allows you to lock a Weapon to a Pointer, so that bullets are always launched from its location.</p>
<p>Calling <code>trackPointer</code> will reset <code>Weapon.trackedSprite</code> to null, should it have been set, as you can
only track <em>either</em> a Pointer, or a Sprite, at once, but not both.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>pointer</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Pointer.html">Phaser.Pointer</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The Pointer to track the position of. Defaults to <code>Input.activePointer</code> if not specified.</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>The horizontal offset from the Pointers position to be applied to the Weapon.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>The vertical offset from the Pointers position to be applied to the Weapon.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>This Weapon instance.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-651">line 651</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="trackSprite"><span class="type-signature"></span>trackSprite<span class="signature">(sprite, <span class="optional">offsetX</span>, <span class="optional">offsetY</span>, <span class="optional">trackRotation</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Sets this Weapon to track the given Sprite, or any Object with a public <code>world</code> Point object.
When a Weapon tracks a Sprite it will automatically update its <code>fireFrom</code> value to match the Sprites
position within the Game World, adjusting the coordinates based on the offset arguments.</p>
<p>This allows you to lock a Weapon to a Sprite, so that bullets are always launched from its location.</p>
<p>Calling <code>trackSprite</code> will reset <code>Weapon.trackedPointer</code> to null, should it have been set, as you can
only track <em>either</em> a Sprite, or a Pointer, at once, but not both.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>sprite</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The Sprite to track the position of.</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>The horizontal offset from the Sprites position to be applied to the Weapon.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>The vertical offset from the Sprites position to be applied to the Weapon.</p></td>
</tr>
<tr>
<td class="name"><code>trackRotation</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Should the Weapon also track the Sprites rotation?</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type"><a href="Phaser.Weapon.html">Phaser.Weapon</a></span>
-
</div>
<div class="returns-desc param-desc">
<p>This Weapon instance.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-618">line 618</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="update"><span class="type-signature">&lt;internal> </span>update<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Internal update method, called by the PluginManager.</p>
</div>
<dl class="details">
<dt class="important tag-deprecated">Internal:</dt>
<dd class="tag-deprecated"><ul>
<li>This member is <em>internal (protected)</em> and may be modified or removed in the future.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="src_plugins_weapon_WeaponPlugin.js.html">plugins/weapon/WeaponPlugin.js</a>, <a href="src_plugins_weapon_WeaponPlugin.js.html#sunlight-1-line-590">line 590</a>
</dt>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
Phaser Copyright © 2012-2016 Photon Storm Ltd.
</span>
<br />
<span class="jsdoc-message">
2016-06-17 11:46:47 +00:00
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.3</a>
2016-07-08 14:46:26 +00:00
on Fri Jul 08 2016 15:42:45 GMT+0100 (GMT Daylight Time) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
2016-06-17 00:11:24 +00:00
</span>
</footer>
</div>
<div class="span3">
<div id="toc"></div>
</div>
<br clear="both">
</div>
</div>
<script src="scripts/sunlight.js"></script>
<script src="scripts/sunlight.javascript.js"></script>
<script src="scripts/sunlight-plugin.doclinks.js"></script>
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
<script src="scripts/sunlight-plugin.menu.js"></script>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/jquery.scrollTo.js"></script>
<script src="scripts/jquery.localScroll.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
<script>
$( function () {
$( "#toc" ).toc( {
anchorName : function(i, heading, prefix) {
return $(heading).attr("id") || ( prefix + i );
},
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
</script>
</body>
</html>