<!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="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-0"> <a href="EarCut.html">EarCut</a> </li> <li class="class-depth-0"> <a href="Event.html">Event</a> </li> <li class="class-depth-0"> <a href="EventTarget.html">EventTarget</a> </li> <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.CanvasPool.html">CanvasPool</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.Hermite.html">Hermite</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.KeyCode.html">KeyCode</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.Path.html">Path</a> </li> <li class="class-depth-1"> <a href="Phaser.PathFollower.html">PathFollower</a> </li> <li class="class-depth-1"> <a href="Phaser.PathPoint.html">PathPoint</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-2"> <a href="Phaser.Plugin.PathManager.html">PathManager</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.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.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.DisplayObject.html">DisplayObject</a> </li> <li class="class-depth-1"> <a href="PIXI.DisplayObjectContainer.html">DisplayObjectContainer</a> </li> <li class="class-depth-1"> <a href="PIXI.FilterTexture.html">FilterTexture</a> </li> <li class="class-depth-2"> <a href="PIXI.Phaser.GraphicsData.html">Phaser.GraphicsData</a> </li> <li class="class-depth-1"> <a href="PIXI.PIXI.html">PIXI</a> </li> <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.PrimitiveShader.html">PrimitiveShader</a> </li> <li class="class-depth-1"> <a href="PIXI.Sprite.html">Sprite</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.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#arc">arc</a> </li> <li class="class-depth-0"> <a href="global.html#AUTO">AUTO</a> </li> <li class="class-depth-0"> <a href="global.html#beginFill">beginFill</a> </li> <li class="class-depth-0"> <a href="global.html#bezierCurveTo">bezierCurveTo</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#clear">clear</a> </li> <li class="class-depth-0"> <a href="global.html#CREATURE">CREATURE</a> </li> <li class="class-depth-0"> <a href="global.html#destroyCachedSprite">destroyCachedSprite</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#drawCircle">drawCircle</a> </li> <li class="class-depth-0"> <a href="global.html#drawEllipse">drawEllipse</a> </li> <li class="class-depth-0"> <a href="global.html#drawPolygon">drawPolygon</a> </li> <li class="class-depth-0"> <a href="global.html#drawRect">drawRect</a> </li> <li class="class-depth-0"> <a href="global.html#drawRoundedRect">drawRoundedRect</a> </li> <li class="class-depth-0"> <a href="global.html#drawShape">drawShape</a> </li> <li class="class-depth-0"> <a href="global.html#ELLIPSE">ELLIPSE</a> </li> <li class="class-depth-0"> <a href="global.html#emit">emit</a> </li> <li class="class-depth-0"> <a href="global.html#EMITTER">EMITTER</a> </li> <li class="class-depth-0"> <a href="global.html#endFill">endFill</a> </li> <li class="class-depth-0"> <a href="global.html#GAMES">GAMES</a> </li> <li class="class-depth-0"> <a href="global.html#generateTexture">generateTexture</a> </li> <li class="class-depth-0"> <a href="global.html#getBounds">getBounds</a> </li> <li class="class-depth-0"> <a href="global.html#getLocalBounds">getLocalBounds</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#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#lineStyle">lineStyle</a> </li> <li class="class-depth-0"> <a href="global.html#lineTo">lineTo</a> </li> <li class="class-depth-0"> <a href="global.html#listeners">listeners</a> </li> <li class="class-depth-0"> <a href="global.html#MATRIX">MATRIX</a> </li> <li class="class-depth-0"> <a href="global.html#mixin">mixin</a> </li> <li class="class-depth-0"> <a href="global.html#moveTo">moveTo</a> </li> <li class="class-depth-0"> <a href="global.html#NONE">NONE</a> </li> <li class="class-depth-0"> <a href="global.html#off">off</a> </li> <li class="class-depth-0"> <a href="global.html#on">on</a> </li> <li class="class-depth-0"> <a href="global.html#once">once</a> </li> <li class="class-depth-0"> <a href="global.html#PENDING_ATLAS">PENDING_ATLAS</a> </li> <li class="class-depth-2"> <a href="global.html#Phaser.Path#numPointsreturn%257Bnumber%257DThetotalnumberofPathPointsinthisPath.">Phaser.Path#numPoints return {number} The total number of PathPoints in this Path.</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#quadraticCurveTo">quadraticCurveTo</a> </li> <li class="class-depth-0"> <a href="global.html#RECTANGLE">RECTANGLE</a> </li> <li class="class-depth-0"> <a href="global.html#removeAllListeners">removeAllListeners</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#stopImmediatePropagation">stopImmediatePropagation</a> </li> <li class="class-depth-0"> <a href="global.html#stopPropagation">stopPropagation</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#updateLocalBounds">updateLocalBounds</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> <li class="class-depth-0"> <a href="global.html#WEBGL_MULTI">WEBGL_MULTI</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.KeyCode.html">Key Codes</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.<br>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<br>can usually do with a Group, such as move it around the display list, iterate it, etc can be done<br>to the bullets Group too.</p> <p>Bullets can have textures and even animations. You can control the speed at which they are fired,<br>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><br><code>weapon.fireFrom.set(300, 300);</code><br><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"><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-443">line 443</a> </dt> </dl> </dd> <dt> <h4 class="name " id=".KILL_DISTANCE"><span class="type-signature"><static, constant> </span>KILL_DISTANCE<span class="type-signature"> :integer</span></h4> </dt> <dd> <div class="description"> <p>A <code>bulletKillType</code> constant that automatically kills the bullets after they<br>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-429">line 429</a> </dt> </dl> </dd> <dt> <h4 class="name " id=".KILL_LIFESPAN"><span class="type-signature"><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-421">line 421</a> </dt> </dl> </dd> <dt> <h4 class="name " id=".KILL_NEVER"><span class="type-signature"><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-414">line 414</a> </dt> </dl> </dd> <dt> <h4 class="name " id=".KILL_STATIC_BOUNDS"><span class="type-signature"><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-457">line 457</a> </dt> </dl> </dd> <dt> <h4 class="name " id=".KILL_WEAPON_BOUNDS"><span class="type-signature"><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-436">line 436</a> </dt> </dl> </dd> <dt> <h4 class="name " id=".KILL_WORLD_BOUNDS"><span class="type-signature"><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-450">line 450</a> </dt> </dl> </dd> <dt> <h4 class="name " id="_hasFired"><span class="type-signature"></span>_hasFired<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>Internal multiFire test flag.</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-359">line 359</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<br>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<br>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.<br>It's used in combination with <code>Weapon.bulletKillType</code> when that is set to either <code>Phaser.Weapon.KILL_WEAPON_BOUNDS</code><br>or <code>Phaser.Weapon.KILL_STATIC_BOUNDS</code>. If you are not using either of these kill types then the bounds are ignored.<br>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.<br>This is useful if for example your bullet sprites have been drawn facing up, instead of<br>to the right, and you want to fire them at an angle. In which case you can set the<br>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.<br>If you fire from an angle of 90 and have a <code>bulletAngleVariance</code> of 20 then the actual<br>angle of the Bullets will be between 70 and 110 degrees. This is a quick way to add a<br>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.<br>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<br>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-1275">line 1275</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-1365">line 1365</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.<br>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<br>chose for each Bullet fired to use the next frame in the set. The frame index is then<br>advanced one frame until it reaches the end of the set, then it starts from the start<br>again. Cycling frames like this allows you to create varied bullet effects via<br>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<br>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"><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.<br>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.<br>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"> <p>If you've set <code>bulletKillType</code> to <code>Phaser.Weapon.KILL_DISTANCE</code> this controls the distance<br>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 "kill types" available:</p> <ul> <li><p><code>Phaser.Weapon.KILL_NEVER</code><br>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><br>The bullets are automatically killed when their <code>bulletLifespan</code> amount expires.</p> </li> <li><p><code>Phaser.Weapon.KILL_DISTANCE</code><br>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><br>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><br>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><br>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><br>The bullets are automatically killed when they no longer intersect with the <code>Weapon.bounds</code> rectangle.<br>The difference between static bounds and weapon bounds, is that a static bounds will never be adjusted to<br>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-1302">line 1302</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"> <p>If you've set <code>bulletKillType</code> to <code>Phaser.Weapon.KILL_LIFESPAN</code> this controls the amount<br>of lifespan the Bullets have set on launch. The value is given in milliseconds.<br>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.<br>This can create the effect of a bullet 'pointing' to the path it is following, for example<br>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<br>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.<br>If bullets have a <code>bulletSpeed</code> value of 200, and a <code>bulletSpeedVariance</code> of 50<br>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<br><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<br>property. It's added to the calculations determining when the Bullet should wrap around<br>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"> <p>The angle at which the bullets are fired. This can be a const such as Phaser.ANGLE_UP<br>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<br>rectangle, the equivalent of a Point. But you can change the width and height, and if<br>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.<br>When the limit is his the <code>Weapon.onFireLimit</code> Signal is dispatched.<br>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<br>to the firing rate of the Weapon. The value is given in milliseconds.<br>If you've a <code>fireRate</code> of 200 and a <code>fireRateVariance</code> of 50 then the actual<br>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="multiFire"><span class="type-signature"></span>multiFire<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> <p>If you want this Weapon to be able to fire more than 1 bullet in a single<br>update, then set this property to <code>true</code>. When <code>true</code> the Weapon plugin won't<br>set the shot / firing timers until the <code>postRender</code> phase of the game loop.<br>This means you can call <code>fire</code> (and similar methods) as often as you like in one<br>single game update.</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-352">line 352</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<br><em>successfully</em> launched. The callback is set two arguments: a reference to the bullet sprite itself,<br>and a reference to the Weapon that fired the bullet.</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-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 > 0, and a bullet launch takes the number<br>of shots fired to equal the fire limit.<br>The callback is sent two arguments: A reference to the Weapon that hit the limit, and the value of<br><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<br>of leaving the Weapon bounds, an expiring lifespan, or exceeding a specified distance.<br>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.<br>You can limit the number of shots allowed (via <code>fireLimit</code>), and reset<br>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.<br>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.<br>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<br>when launching from a tracked Sprite or Pointer. For example if you've got a bullet that is 2x2 pixels<br>in size, but you're tracking a Sprite that is 32x32, then you can set <code>trackOffset.x = 16</code> to have<br>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-378">line 378</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?<br>This is useful for a game such as Asteroids, where you want the weapon to fire based<br>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-368">line 368</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<br>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-1390">line 1390</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<br>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-1412">line 1412</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"> → {<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.<br>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<br>bullets fired will play using this animation. You can swap between animations by calling this method<br>several times, and then just changing the <code>Weapon.bulletAnimation</code> property to the name of the animation<br>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. "fire", "blast".</p></td> </tr> <tr> <td class="name"><code>frames</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="attributes"> <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"> <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"> <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"> <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-1212">line 1212</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"> → {<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,<br>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<br>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<br>in-flight simultaneously. If you try to fire an 11th bullet then nothing will happen until one, or more, of<br>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<br>keep increasing the size of the bullet pool as needed. It will never reduce the size of the pool however,<br>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><br>properties. You can also animate bullets, or set them to use random frames. All Bullets belonging to a<br>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"> <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"> <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"> <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"> <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-459">line 459</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<br>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"> <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"> <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"> <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-1250">line 1250</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<br>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-605">line 605</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 class="optional">offsetX</span>, <span class="optional">offsetY</span>)</span><span class="type-signature"> → {<a href="Phaser.Bullet.html">Phaser.Bullet</a>}</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,<br>then this method returns <code>null</code>. It will also return <code>null</code> if not enough time has expired since the last time<br>the Weapon was fired, as defined in the <code>Weapon.fireRate</code> property.</p> <p>Otherwise the first available bullet is selected, launched, and returned.</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>,<br><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<br>calculated based on Weapon properties like <code>bulletSpeed</code>.</p> <p>If you wish to fire multiple bullets in a single game update, then set <code>Weapon.multiFire = true</code><br>and you can call <code>fire</code> as many times as you like, per loop. Multiple fires in a single update<br>only counts once towards the <code>shots</code> total, but you will still receive a Signal for each bullet.</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>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> | <span class="param-type">string</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> </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"> <optional><br> </td> <td class="default"> </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>, or <code>null</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"> <optional><br> </td> <td class="default"> </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>, or <code>null</code>, the bullet direction is based on its angle.</p></td> </tr> <tr> <td class="name"><code>offsetX</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>If the bullet is fired from a tracked Sprite or Pointer, or the <code>from</code> argument is set, this applies a horizontal offset from the launch position.</p></td> </tr> <tr> <td class="name"><code>offsetY</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>If the bullet is fired from a tracked Sprite or Pointer, or the <code>from</code> argument is set, this applies a vertical offset from the launch position.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="Phaser.Bullet.html">Phaser.Bullet</a></span> - </div> <div class="returns-desc param-desc"> <p>The fired bullet, if a launch was successful, otherwise <code>null</code>.</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-817">line 817</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"> → {<a href="Phaser.Bullet.html">Phaser.Bullet</a>}</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,<br>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"> <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"><a href="Phaser.Bullet.html">Phaser.Bullet</a></span> - </div> <div class="returns-desc param-desc"> <p>The fired bullet if successful, null otherwise.</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-1092">line 1092</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"> → {<a href="Phaser.Bullet.html">Phaser.Bullet</a>}</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,<br>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"> <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"><a href="Phaser.Bullet.html">Phaser.Bullet</a></span> - </div> <div class="returns-desc param-desc"> <p>The fired bullet if successful, null otherwise.</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-1108">line 1108</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"> → {<a href="Phaser.Bullet.html">Phaser.Bullet</a>}</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,<br>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"> <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"> <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"><a href="Phaser.Bullet.html">Phaser.Bullet</a></span> - </div> <div class="returns-desc param-desc"> <p>The fired bullet if successful, null otherwise.</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-1122">line 1122</a> </dt> </dl> </dd> <dt> <h4 class="name " id="fireMany"><span class="type-signature"></span>fireMany<span class="signature">(positions, <span class="optional">from</span>)</span><span class="type-signature"> → {array}</span></h4> </dt> <dd> <div class="description"> <p>Attempts to fire multiple bullets from the positions defined in the given array.</p> <p>If you provide a <code>from</code> argument, or if there is a tracked Sprite or Pointer, then<br>the positions are treated as <strong>offsets</strong> from the given objects position.</p> <p>If <code>from</code> is undefined, and there is no tracked object, then the bullets are fired<br>from the given positions, as they exist in the world.</p> <p>Calling this method sets <code>Weapon.multiFire = true</code>.</p> <p>If there are not enough bullets available in the pool, and the pool cannot be extended,<br>then this method may not fire from all of the given positions.</p> <p>When the bullets are launched they have their texture and frame updated, as required.<br>The velocity of the bullets are 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>positions</code></td> <td class="type"> <span class="param-type">array</span> </td> <td class="attributes"> </td> <td class="description last"><p>An array of positions. Each position can be any Object, as long as it has public <code>x</code> and <code>y</code> properties, such as Phaser.Point, { x: 0, y: 0 }, Phaser.Sprite, etc.</p></td> </tr> <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> | <span class="param-type">string</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Optionally fires the bullets <strong>from</strong> the <code>x</code> and <code>y</code> properties of this object, <em>instead</em> of any <code>Weapon.trackedSprite</code> or <code>trackedPointer</code> that is set.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">array</span> - </div> <div class="returns-desc param-desc"> <p>An array containing all of the fired Phaser.Bullet objects, if a launch was successful, otherwise an empty array.</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-736">line 736</a> </dt> </dl> </dd> <dt> <h4 class="name " id="fireOffset"><span class="type-signature"></span>fireOffset<span class="signature">(<span class="optional">offsetX</span>, <span class="optional">offsetY</span>)</span><span class="type-signature"> → {<a href="Phaser.Bullet.html">Phaser.Bullet</a>}</span></h4> </dt> <dd> <div class="description"> <p>Attempts to fire a single Bullet from a tracked Sprite or Pointer, but applies an offset<br>to the position first. This is the same as calling <code>Weapon.fire</code> and passing in the offset arguments.</p> <p>If there are no more bullets available in the pool, and the pool cannot be extended,<br>then this method returns <code>null</code>. It will also return <code>null</code> if not enough time has expired since the last time<br>the Weapon was fired, as defined in the <code>Weapon.fireRate</code> property.</p> <p>Otherwise the first available bullet is selected, launched, and returned.</p> <p>When the bullet is launched it has its texture and frame updated, as required. The velocity of the bullet is<br>calculated based on Weapon properties like <code>bulletSpeed</code>.</p> <p>If you wish to fire multiple bullets in a single game update, then set <code>Weapon.multiFire = true</code><br>and you can call this method as many times as you like, per loop. See also <code>Weapon.fireMany</code>.</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>offsetX</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>The horizontal offset from the position of the tracked Sprite or Pointer, as set with <code>Weapon.trackSprite</code>.</p></td> </tr> <tr> <td class="name"><code>offsetY</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>The vertical offset from the position of the tracked Sprite or Pointer, as set with <code>Weapon.trackSprite</code>.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type"><a href="Phaser.Bullet.html">Phaser.Bullet</a></span> - </div> <div class="returns-desc param-desc"> <p>The fired bullet, if a launch was successful, otherwise <code>null</code>.</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-787">line 787</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"> → {<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"> <optional><br> <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-516">line 516</a> </dt> </dl> </dd> <dt> <h4 class="name " id="killAll"><span class="type-signature"></span>killAll<span class="signature">()</span><span class="type-signature"> → {<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.<br>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-567">line 567</a> </dt> </dl> </dd> <dt> <h4 class="name " id="pauseAll"><span class="type-signature"></span>pauseAll<span class="signature">()</span><span class="type-signature"> → {<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.<br>This has the effect of stopping them in-flight should they be moving.<br>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-535">line 535</a> </dt> </dl> </dd> <dt> <h4 class="name " id="postRender"><span class="type-signature"><internal> </span>postRender<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-652">line 652</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"> → {<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<br><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"> <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-584">line 584</a> </dt> </dl> </dd> <dt> <h4 class="name " id="resumeAll"><span class="type-signature"></span>resumeAll<span class="signature">()</span><span class="type-signature"> → {<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.<br>This has the effect of resuming their motion should they be in-flight.<br>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-551">line 551</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"> → {<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.<br>This allows you to make it smaller, or larger, than the parent Sprite.<br>You can also control the x and y offset of the Body. This is the position of the<br>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,<br>and you want the physics body to be 32x32 pixels in the middle of the texture, you would do:</p> <p><code>setSize(32 / Math.abs(this.scale.x), 32 / Math.abs(this.scale.y), 24, 34)</code></p> <p>Where the first two parameters are the new Body size (32x32 pixels) relative to the Sprite's scale.<br>24 is the horizontal offset of the Body from the top-left of the Sprites texture, and 34<br>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"> <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"> <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-1137">line 1137</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"> → {<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<br>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<br>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"> <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"> <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-1178">line 1178</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"> → {<a href="Phaser.Weapon.html">Phaser.Weapon</a>}</span></h4> </dt> <dd> <div class="description"> <p>Sets this Weapon to track the given Pointer.<br>When a Weapon tracks a Pointer it will automatically update its <code>fireFrom</code> value to match the Pointers<br>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<br>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"> <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"> <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"> <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-704">line 704</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"> → {<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.<br>When a Weapon tracks a Sprite it will automatically update its <code>fireFrom</code> value to match the Sprites<br>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<br>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"> <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"> <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"> <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-671">line 671</a> </dt> </dl> </dd> <dt> <h4 class="name " id="update"><span class="type-signature"><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-624">line 624</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"> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Dec 05 2016 10:04:39 GMT+0000 (GMT Standard Time) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>. </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>