phaser/Docs/out/Phaser.Group.html
Richard Davey 852e82d0ca More docs.
2013-10-02 12:11:22 +01:00

6172 lines
No EOL
83 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phaser Class: Group</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<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 class="navbar-inner">
<a class="brand" href="index.html">Phaser</a>
<ul class="nav">
<li class="dropdown">
<a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="module-Phaser.html">Phaser</a>
</li>
<li>
<a href="PluginManager.html">PluginManager</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>
<a href="Phaser.Animation.html">Animation</a>
</li>
<li>
<a href="Phaser.Animation.Frame.html">Frame</a>
</li>
<li>
<a href="Phaser.Animation.FrameData.html">FrameData</a>
</li>
<li>
<a href="Phaser.Animation.Parser.html">Parser</a>
</li>
<li>
<a href="Phaser.AnimationManager.html">AnimationManager</a>
</li>
<li>
<a href="Phaser.Camera.html">Camera</a>
</li>
<li>
<a href="Phaser.Circle.html">Circle</a>
</li>
<li>
<a href="Phaser.Game.html">Game</a>
</li>
<li>
<a href="Phaser.Group.html">Group</a>
</li>
<li>
<a href="Phaser.LinkedList.html">LinkedList</a>
</li>
<li>
<a href="PluginManager-Phaser.PluginManager.html">PluginManager</a>
</li>
<li>
<a href="Phaser.Plugin.html">Plugin</a>
</li>
<li>
<a href="Phaser.Point.html">Point</a>
</li>
<li>
<a href="Phaser.Rectangle.html">Rectangle</a>
</li>
<li>
<a href="Phaser.Signal.html">Signal</a>
</li>
<li>
<a href="Phaser.Stage.html">Stage</a>
</li>
<li>
<a href="Phaser.State.html">State</a>
</li>
<li>
<a href="Phaser.StateManager.html">StateManager</a>
</li>
<li>
<a href="Phaser.World.html">World</a>
</li>
<li>
<a href="SignalBinding.html">SignalBinding</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<div id="main">
<h1 class="page-title">Class: Group</h1>
<section>
<header>
<h2>
Group
</h2>
<div class="class-description"><p>A Group is a container for display objects that allows for fast pooling, recycling and collision checks.</p></div>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="Group"><span class="type-signature"></span>new Group<span class="signature">(game, parent, <span class="optional">name</span>, <span class="optional">useStage</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Phaser Group constructor.</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>game</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Game.html">Phaser.Game</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>A reference to the currently running game.</p></td>
</tr>
<tr>
<td class="name"><code>parent</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The parent Group or DisplayObjectContainer that will hold this group, if any.</p></td>
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
group
</td>
<td class="description last"><p>A name for this Group. Not used internally but useful for debugging.</p></td>
</tr>
<tr>
<td class="name"><code>useStage</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Only the root World Group should use this value.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-17">line 17</a>
</li></ul></dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<dt>
<h4 class="name" id="angle"><span class="type-signature"></span>angle<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>The angle of rotation of the Group container. This will adjust the Group container itself by modifying its rotation.
This will have no impact on the rotation value of its children, but it will update their worldTransform and on-screen position.</p>
</div>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>angle</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The angle of rotation given in degrees, where 0 degrees = to the right.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1106">line 1106</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="exists"><span class="type-signature"></span>exists<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>exists</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If exists is true the the Group is updated, otherwise it is skipped.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="dummy"><li>true</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-72">line 72</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="game"><span class="type-signature"></span>game<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props 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 currently running Game.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-29">line 29</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="length"><span class="type-signature">&lt;readonly> </span>length<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The number of children in this Group.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1057">line 1057</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="name"><span class="type-signature"></span>name<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</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="description last"><p>A name for this Group. Not used internally but useful for debugging.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-34">line 34</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="rotation"><span class="type-signature"></span>rotation<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>The angle of rotation of the Group container. This will adjust the Group container itself by modifying its rotation.
This will have no impact on the rotation value of its children, but it will update their worldTransform and on-screen position.</p>
</div>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>rotation</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The angle of rotation given in radians.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1124">line 1124</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="type"><span class="type-signature">&lt;protected> </span>type<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Internal Phaser Type value.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-66">line 66</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="visible"><span class="type-signature"></span>visible<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>visible</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>The visible state of the Group. Non-visible Groups and all of their children are not rendered.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1142">line 1142</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="x"><span class="type-signature"></span>x<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>The x coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates.
This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position.</p>
</div>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</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="description last"><p>The x coordinate of the Group container.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1070">line 1070</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="y"><span class="type-signature"></span>y<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>The y coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates.
This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position.</p>
</div>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The y coordinate of the Group container.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1088">line 1088</a>
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="add"><span class="type-signature"></span>add<span class="signature">(child)</span><span class="type-signature"> &rarr; {*}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object.
The child is automatically added to the top of the Group, so renders on-top of everything else within the Group. If you need to control
that then see the addAt method.</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>child</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"><p>An instance of Phaser.Sprite, Phaser.Button or any other display object..</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-78">line 78</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="Phaser.Group.html#create">Phaser.Group#create</a></li>
<li><a href="Phaser.Group.html#addAt">Phaser.Group#addAt</a></li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The child that was added to the Group.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addAll"><span class="type-signature"></span>addAll<span class="signature">(property, amount, checkAlive, checkVisible)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Adds the amount to the given property on all children in this Group.
Group.addAll('x', 10) will add 10 to the child.x value.</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>property</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The property to increment, for example 'body.velocity.x' or 'angle'.</p></td>
</tr>
<tr>
<td class="name"><code>amount</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The amount to increment the property by. If child.x = 10 then addAll('x', 40) would make child.x = 50.</p></td>
</tr>
<tr>
<td class="name"><code>checkAlive</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true the property will only be changed if the child is alive.</p></td>
</tr>
<tr>
<td class="name"><code>checkVisible</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true the property will only be changed if the child is visible.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-471">line 471</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addAt"><span class="type-signature"></span>addAt<span class="signature">(child, index)</span><span class="type-signature"> &rarr; {*}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object.
The child is added to the Group at the location specified by the index value, this allows you to control child ordering.</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>child</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"><p>An instance of Phaser.Sprite, Phaser.Button or any other display object..</p></td>
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The index within the Group to insert the child to.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-107">line 107</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The child that was added to the Group.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="bringToTop"><span class="type-signature"></span>bringToTop<span class="signature">(child)</span><span class="type-signature"> &rarr; {*}</span></h4>
</dt>
<dd>
<div class="description">
<p>Brings the given child to the top of this Group so it renders above all other children.</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>child</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"><p>The child to bring to the top of this Group.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-308">line 308</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The child that was moved.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="callAll"><span class="type-signature"></span>callAll<span class="signature">(callback, parameter)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Calls a function on all of the children regardless if they are dead or alive (see callAllExists if you need control over that)
After the callback parameter you can add as many extra parameters as you like, which will all be passed to the child.</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>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The function that exists on the children that will be called.</p></td>
</tr>
<tr>
<td class="name"><code>parameter</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
&lt;repeatable><br>
</td>
<td class="description last"><p>Additional parameters that will be passed to the callback.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-567">line 567</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="callAllExists"><span class="type-signature"></span>callAllExists<span class="signature">(callback, existsValue, parameter)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Calls a function on all of the children that have exists=true in this Group.
After the existsValue parameter you can add as many parameters as you like, which will all be passed to the child callback.</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>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The function that exists on the children that will be called.</p></td>
</tr>
<tr>
<td class="name"><code>existsValue</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Only children with exists=existsValue will be called.</p></td>
</tr>
<tr>
<td class="name"><code>parameter</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
&lt;repeatable><br>
</td>
<td class="description last"><p>Additional parameters that will be passed to the callback.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-535">line 535</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="countDead"><span class="type-signature"></span>countDead<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Call this function to find out how many members of the group are dead.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-827">line 827</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The number of children flagged as dead. Returns -1 if Group is empty.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="countLiving"><span class="type-signature"></span>countLiving<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Call this function to find out how many members of the group are alive.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-797">line 797</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The number of children flagged as alive. Returns -1 if Group is empty.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="create"><span class="type-signature"></span>create<span class="signature">(x, y, key, <span class="optional">frame</span>, <span class="optional">exists</span>)</span><span class="type-signature"> &rarr; {Phaser.Sprite}</span></h4>
</dt>
<dd>
<div class="description">
<p>Automatically creates a new Phaser.Sprite object and adds it to the top of this Group.
Useful if you don't need to create the Sprite instances before-hand.</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">
</td>
<td class="description last"><p>The x coordinate to display the newly created Sprite at. The value is in relation to the Group.x point.</p></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The y coordinate to display the newly created Sprite at. The value is in relation to the Group.y point.</p></td>
</tr>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</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">number</span>
|
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</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>exists</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The default exists state of the Sprite.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-148">line 148</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The child that was created.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Phaser.Sprite</span>
</dd>
</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 Group. Removes all children, then removes the container from the display list and nulls references.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-946">line 946</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="divideAll"><span class="type-signature"></span>divideAll<span class="signature">(property, amount, checkAlive, checkVisible)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Divides the given property by the amount on all children in this Group.
Group.divideAll('x', 2) will half the child.x value.</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>property</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The property to divide, for example 'body.velocity.x' or 'angle'.</p></td>
</tr>
<tr>
<td class="name"><code>amount</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The amount to divide the property by. If child.x = 100 then divideAll('x', 2) would make child.x = 50.</p></td>
</tr>
<tr>
<td class="name"><code>checkAlive</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true the property will only be changed if the child is alive.</p></td>
</tr>
<tr>
<td class="name"><code>checkVisible</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true the property will only be changed if the child is visible.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-519">line 519</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="dump"><span class="type-signature"></span>dump<span class="signature">(<span class="optional">full</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Dumps out a list of Group children and their index positions to the browser console. Useful for group debugging.</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>full</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>If full the dump will include the entire display list, start from the Stage. Otherwise it will only include this container.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-965">line 965</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="forEach"><span class="type-signature"></span>forEach<span class="signature">(callback, callbackContext, checkExists)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run.
After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child.
For example: Group.forEach(awardBonusGold, this, true, 100, 500)</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>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>The function that will be called. Each child of the Group will be passed to it as its first parameter.</p></td>
</tr>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
<span class="param-type">Object</span>
</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>checkExists</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If set only children with exists=true will be passed to the callback, otherwise all children will be passed.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-598">line 598</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="forEachAlive"><span class="type-signature"></span>forEachAlive<span class="signature">(callback, callbackContext)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Allows you to call your own function on each alive member of this Group (where child.alive=true). You must pass the callback and context in which it will run.
You can add as many parameters as you like, which will all be passed to the callback along with the child.
For example: Group.forEachAlive(causeDamage, this, 500)</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>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>The function that will be called. Each child of the Group will be passed to it as its first parameter.</p></td>
</tr>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>The context in which the function should be called (usually 'this').</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-638">line 638</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="forEachDead"><span class="type-signature"></span>forEachDead<span class="signature">(callback, callbackContext)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Allows you to call your own function on each dead member of this Group (where alive=false). You must pass the callback and context in which it will run.
You can add as many parameters as you like, which will all be passed to the callback along with the child.
For example: Group.forEachDead(bringToLife, this)</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>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>The function that will be called. Each child of the Group will be passed to it as its first parameter.</p></td>
</tr>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>The context in which the function should be called (usually 'this').</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-672">line 672</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getAt"><span class="type-signature"></span>getAt<span class="signature">(index)</span><span class="type-signature"> &rarr; {*}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns the child found at the given index within this Group.</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>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The index to return the child from.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-134">line 134</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The child that was found at the given index.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getFirstAlive"><span class="type-signature"></span>getFirstAlive<span class="signature">()</span><span class="type-signature"> &rarr; {Any}</span></h4>
</dt>
<dd>
<div class="description">
<p>Call this function to retrieve the first object with alive == true in the group.
This is handy for checking if everything has been wiped out, or choosing a squad leader, etc.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-739">line 739</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The first alive child, or null if none found.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Any</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getFirstDead"><span class="type-signature"></span>getFirstDead<span class="signature">()</span><span class="type-signature"> &rarr; {Any}</span></h4>
</dt>
<dd>
<div class="description">
<p>Call this function to retrieve the first object with alive == false in the group.
This is handy for checking if everything has been wiped out, or choosing a squad leader, etc.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-768">line 768</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The first dead child, or null if none found.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Any</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getFirstExists"><span class="type-signature"></span>getFirstExists<span class="signature">(state)</span><span class="type-signature"> &rarr; {Any}</span></h4>
</dt>
<dd>
<div class="description">
<p>Call this function to retrieve the first object with exists == (the given state) in the Group.</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>state</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>True or false.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-705">line 705</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The first child, or null if none found.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Any</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getIndex"><span class="type-signature"></span>getIndex<span class="signature">(child)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Get the index position of the given child in this Group.</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>child</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"><p>The child to get the index for.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-327">line 327</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The index of the child or -1 if it's not a member of this Group.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getRandom"><span class="type-signature"></span>getRandom<span class="signature">(startIndex, length)</span><span class="type-signature"> &rarr; {Any}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns a member at random from the group.</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>startIndex</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Optional offset off the front of the array. Default value is 0, or the beginning of the array.</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Optional restriction on the number of values you want to randomly select from.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-857">line 857</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A random child of this Group.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Any</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="multiplyAll"><span class="type-signature"></span>multiplyAll<span class="signature">(property, amount, checkAlive, checkVisible)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Multiplies the given property by the amount on all children in this Group.
Group.multiplyAll('x', 2) will x2 the child.x value.</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>property</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The property to multiply, for example 'body.velocity.x' or 'angle'.</p></td>
</tr>
<tr>
<td class="name"><code>amount</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The amount to multiply the property by. If child.x = 10 then multiplyAll('x', 2) would make child.x = 20.</p></td>
</tr>
<tr>
<td class="name"><code>checkAlive</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true the property will only be changed if the child is alive.</p></td>
</tr>
<tr>
<td class="name"><code>checkVisible</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true the property will only be changed if the child is visible.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-503">line 503</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(child)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Removes the given child from this Group and sets its group property to null.</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>child</code></td>
<td class="type">
<span class="param-type">Any</span>
</td>
<td class="description last"><p>The child to remove.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-879">line 879</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="removeAll"><span class="type-signature"></span>removeAll<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Removes all children from this Group, setting all group properties to null.
The Group container remains on the display list.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-893">line 893</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="removeBetween"><span class="type-signature"></span>removeBetween<span class="signature">(startIndex, endIndex)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Removes all children from this Group whos index falls beteen the given startIndex and endIndex values.</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>startIndex</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The index to start removing children from.</p></td>
</tr>
<tr>
<td class="name"><code>endIndex</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The index to stop removing children from. Must be higher than startIndex and less than the length of the Group.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-918">line 918</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="replace"><span class="type-signature"></span>replace<span class="signature">(oldChild, newChild)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Replaces a child of this Group with the given newChild. The newChild cannot be a member of this Group.</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>oldChild</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"><p>The child in this Group that will be replaced.</p></td>
</tr>
<tr>
<td class="name"><code>newChild</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"><p>The child to be inserted into this group.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-340">line 340</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setAll"><span class="type-signature"></span>setAll<span class="signature">(key, value, <span class="optional">checkAlive</span>, <span class="optional">checkVisible</span>, <span class="optional">operation</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>This function allows you to quickly set the same property across all children of this Group to a new value.
The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.</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>key</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 property, as a string, to be set. For example: 'body.velocity.x'</p></td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The value that will be set.</p></td>
</tr>
<tr>
<td class="name"><code>checkAlive</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>If set then only children with alive=true will be updated.</p></td>
</tr>
<tr>
<td class="name"><code>checkVisible</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>If set then only children with visible=true will be updated.</p></td>
</tr>
<tr>
<td class="name"><code>operation</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-433">line 433</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setProperty"><span class="type-signature"></span>setProperty<span class="signature">(child, key, value, <span class="optional">operation</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Sets the given property to the given value on the child. The operation controls the assignment of the value.</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>child</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The child to set the property value on.</p></td>
</tr>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>An array of strings that make up the property that will be set.</p></td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The value that will be set.</p></td>
</tr>
<tr>
<td class="name"><code>operation</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-371">line 371</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="subAll"><span class="type-signature"></span>subAll<span class="signature">(property, amount, checkAlive, checkVisible)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Subtracts the amount from the given property on all children in this Group.
Group.subAll('x', 10) will minus 10 from the child.x value.</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>property</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The property to decrement, for example 'body.velocity.x' or 'angle'.</p></td>
</tr>
<tr>
<td class="name"><code>amount</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The amount to subtract from the property. If child.x = 50 then subAll('x', 40) would make child.x = 10.</p></td>
</tr>
<tr>
<td class="name"><code>checkAlive</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true the property will only be changed if the child is alive.</p></td>
</tr>
<tr>
<td class="name"><code>checkVisible</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true the property will only be changed if the child is visible.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-487">line 487</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="swap"><span class="type-signature"></span>swap<span class="signature">(child1, child2)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Swaps the position of two children in this Group.</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>child1</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"><p>The first child to swap.</p></td>
</tr>
<tr>
<td class="name"><code>child2</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"><p>The second child to swap.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-180">line 180</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True if the swap was successful, otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
Phaser Copyright © 2012-2013 Photon Storm Ltd.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.0-dev</a>
on Wed Oct 02 2013 12:09:54 GMT+0100 (BST) 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( {
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>