phaser/Docs/out/Phaser.Group.html

6120 lines
82 KiB
HTML
Raw Normal View History

2013-10-02 00:16:40 +00:00
<!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>
</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.Game.html">Game</a>
</li>
<li>
<a href="Phaser.Group.html">Group</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>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<th>Argument</th>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<th>Default</th>
2013-10-02 00:16:40 +00:00
<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>
2013-10-02 10:22:20 +00:00
<td class="attributes">
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
</td>
<td class="default">
</td>
2013-10-02 00:16:40 +00:00
<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">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
</td>
<td class="description last"><p>The parent Group or DisplayObjectContainer that will hold this group, if any.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
&lt;optional><br>
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
group
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="description last"><p>A name for this Group. Not used internally but useful for debugging.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>useStage</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
&lt;optional><br>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
false
</td>
<td class="description last"><p>Only the root World Group should use this value.</p></td>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1105">line 1105</a>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>If exists is true the the Group is updated, otherwise it is skipped.</p></td>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-72">line 72</a>
2013-10-02 00:16:40 +00:00
</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"></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>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1057">line 1057</a>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">string</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>A name for this Group. Not used internally but useful for debugging.</p></td>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1123">line 1123</a>
2013-10-02 00:16:40 +00:00
</li></ul></dd>
</dl>
</dd>
<dt>
2013-10-02 10:22:20 +00:00
<h4 class="name" id="type"><span class="type-signature">&lt;protected> </span>type<span class="type-signature"></span></h4>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">number</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>Internal Phaser Type value.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-66">line 66</a>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1141">line 1141</a>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1069">line 1069</a>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-1087">line 1087</a>
2013-10-02 00:16:40 +00:00
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
2013-10-02 10:22:20 +00:00
<h4 class="name" id="add"><span class="type-signature"></span>add<span class="signature">(child)</span><span class="type-signature"> &rarr; {*}</span></h4>
2013-10-02 00:16:40 +00:00
</dt>
<dd>
<div class="description">
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>An instance of Phaser.Sprite, Phaser.Button or any other display object..</p></td>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-78">line 78</a>
2013-10-02 00:16:40 +00:00
</li></ul></dd>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</dl>
<h5>Returns:</h5>
<div class="param-desc">
2013-10-02 10:22:20 +00:00
<p>The child that was added to the Group.</p>
2013-10-02 00:16:40 +00:00
</div>
<dl>
<dt>
Type
</dt>
<dd>
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<h4 class="name" id="addAt"><span class="type-signature"></span>addAt<span class="signature">(child, index)</span><span class="type-signature"> &rarr; {*}</span></h4>
2013-10-02 00:16:40 +00:00
</dt>
<dd>
<div class="description">
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>An instance of Phaser.Sprite, Phaser.Button or any other display object..</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">number</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The index within the Group to insert the child to.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-107">line 107</a>
2013-10-02 00:16:40 +00:00
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
2013-10-02 10:22:20 +00:00
<p>The child that was added to the Group.</p>
2013-10-02 00:16:40 +00:00
</div>
<dl>
<dt>
Type
</dt>
<dd>
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</dd>
</dl>
</dd>
<dt>
2013-10-02 10:22:20 +00:00
<h4 class="name" id="bringToTop"><span class="type-signature"></span>bringToTop<span class="signature">(child)</span><span class="type-signature"> &rarr; {*}</span></h4>
2013-10-02 00:16:40 +00:00
</dt>
<dd>
<div class="description">
2013-10-02 10:22:20 +00:00
<p>Brings the given child to the top of this Group so it renders above all other children.</p>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The child to bring to the top of this Group.</p></td>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<p>The child that was moved.</p>
2013-10-02 00:16:40 +00:00
</div>
<dl>
<dt>
Type
</dt>
<dd>
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-827">line 827</a>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-797">line 797</a>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</dt>
<dd>
<div class="description">
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The Game.cache key of the image that this Sprite will use.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>frame</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">number</span>
|
2013-10-02 00:16:40 +00:00
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>If the Sprite image contains multiple frames you can specify which one to use here.</p></td>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The default exists state of the Sprite.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-148">line 148</a>
2013-10-02 00:16:40 +00:00
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
2013-10-02 10:22:20 +00:00
<p>The child that was created.</p>
2013-10-02 00:16:40 +00:00
</div>
<dl>
<dt>
Type
</dt>
<dd>
2013-10-02 10:22:20 +00:00
<span class="param-type">Phaser.Sprite</span>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<p>Destroys this Group. Removes all children, then removes the container from the display list and nulls references.</p>
2013-10-02 00:16:40 +00:00
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-946">line 946</a>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</dt>
<dd>
<div class="description">
2013-10-02 10:22:20 +00:00
<p>Dumps out a list of Group children and their index positions to the browser console. Useful for group debugging.</p>
2013-10-02 00:16:40 +00:00
</div>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-965">line 965</a>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">function</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">Object</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The context in which the function should be called (usually 'this').</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>checkExists</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">function</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">Object</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The context in which the function should be called (usually 'this').</p></td>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-638">line 638</a>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">function</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">Object</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The context in which the function should be called (usually 'this').</p></td>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-672">line 672</a>
2013-10-02 00:16:40 +00:00
</li></ul></dd>
</dl>
</dd>
<dt>
2013-10-02 10:22:20 +00:00
<h4 class="name" id="getAt"><span class="type-signature"></span>getAt<span class="signature">(index)</span><span class="type-signature"> &rarr; {*}</span></h4>
2013-10-02 00:16:40 +00:00
</dt>
<dd>
<div class="description">
2013-10-02 10:22:20 +00:00
<p>Returns the child found at the given index within this Group.</p>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">number</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The index to return the child from.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-134">line 134</a>
2013-10-02 00:16:40 +00:00
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
2013-10-02 10:22:20 +00:00
<p>The child that was found at the given index.</p>
2013-10-02 00:16:40 +00:00
</div>
<dl>
<dt>
Type
</dt>
<dd>
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</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.
2013-10-02 10:22:20 +00:00
This is handy for checking if everything has been wiped out, or choosing a squad leader, etc.</p>
2013-10-02 00:16:40 +00:00
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-739">line 739</a>
2013-10-02 00:16:40 +00:00
</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.
2013-10-02 10:22:20 +00:00
This is handy for checking if everything has been wiped out, or choosing a squad leader, etc.</p>
2013-10-02 00:16:40 +00:00
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-768">line 768</a>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<p>Call this function to retrieve the first object with exists == (the given state) in the Group.</p>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">boolean</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>True or false.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-705">line 705</a>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<h4 class="name" id="getIndex"><span class="type-signature"></span>getIndex<span class="signature">(child)</span><span class="type-signature"> &rarr; {number}</span></h4>
2013-10-02 00:16:40 +00:00
</dt>
<dd>
<div class="description">
2013-10-02 10:22:20 +00:00
<p>Get the index position of the given child in this Group.</p>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The child to get the index for.</p></td>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<p>The index of the child or -1 if it's not a member of this Group.</p>
2013-10-02 00:16:40 +00:00
</div>
<dl>
<dt>
Type
</dt>
<dd>
2013-10-02 10:22:20 +00:00
<span class="param-type">number</span>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-857">line 857</a>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<p>Removes the given child from this Group and sets its group property to null.</p>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">Any</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The child to remove.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-879">line 879</a>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<p>Removes all children from this Group, setting all group properties to null.
The Group container remains on the display list.</p>
2013-10-02 00:16:40 +00:00
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-893">line 893</a>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<p>Removes all children from this Group whos index falls beteen the given startIndex and endIndex values.</p>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">number</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The index to start removing children from.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>endIndex</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">number</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-918">line 918</a>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<p>Replaces a child of this Group with the given newChild. The newChild cannot be a member of this Group.</p>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The child in this Group that will be replaced.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>newChild</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The child to be inserted into this group.</p></td>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</dt>
<dd>
<div class="description">
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
2013-10-02 10:22:20 +00:00
<th>Argument</th>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<th>Default</th>
2013-10-02 00:16:40 +00:00
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">string</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
</td>
<td class="description last"><p>The property, as a string, to be set. For example: 'body.velocity.x'</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
</td>
<td class="description last"><p>The value that will be set.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>checkAlive</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">boolean</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
&lt;optional><br>
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
false
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="description last"><p>If set then only children with alive=true will be updated.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>checkVisible</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">boolean</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
&lt;optional><br>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
false
</td>
<td class="description last"><p>If set then only children with visible=true will be updated.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>operation</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">number</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
&lt;optional><br>
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
0
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2013-10-02 10:22:20 +00:00
<a href="Group.js.html">core/Group.js</a>, <a href="Group.js.html#sunlight-1-line-433">line 433</a>
2013-10-02 00:16:40 +00:00
</li></ul></dd>
</dl>
</dd>
<dt>
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</dt>
<dd>
<div class="description">
2013-10-02 10:22:20 +00:00
<p>Sets the given property to the given value on the child. The operation controls the assignment of the value.</p>
2013-10-02 00:16:40 +00:00
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
2013-10-02 10:22:20 +00:00
<th>Argument</th>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<th>Default</th>
2013-10-02 00:16:40 +00:00
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>child</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
</td>
<td class="description last"><p>The child to set the property value on.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
</td>
<td class="description last"><p>An array of strings that make up the property that will be set.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="default">
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The value that will be set.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>operation</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">number</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="attributes">
&lt;optional><br>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
</td>
<td class="default">
0
</td>
2013-10-02 00:16:40 +00:00
2013-10-02 10:22:20 +00:00
<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>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<p>Swaps the position of two children in this Group.</p>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The first child to swap.</p></td>
2013-10-02 00:16:40 +00:00
</tr>
<tr>
<td class="name"><code>child2</code></td>
<td class="type">
2013-10-02 10:22:20 +00:00
<span class="param-type">*</span>
2013-10-02 00:16:40 +00:00
</td>
2013-10-02 10:22:20 +00:00
<td class="description last"><p>The second child to swap.</p></td>
2013-10-02 00:16:40 +00:00
</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">
2013-10-02 10:22:20 +00:00
<p>True if the swap was successful, otherwise false.</p>
2013-10-02 00:16:40 +00:00
</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>
2013-10-02 10:22:20 +00:00
on Wed Oct 02 2013 01:51:38 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
2013-10-02 00:16:40 +00:00
</span>
</footer>
</div>
<div class="span3">
<div id="toc"></div>
</div>
<br clear="both">
</div>
</div>
<script src="scripts/sunlight.js"></script>
<script src="scripts/sunlight.javascript.js"></script>
<script src="scripts/sunlight-plugin.doclinks.js"></script>
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
<script src="scripts/sunlight-plugin.menu.js"></script>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/jquery.scrollTo.js"></script>
<script src="scripts/jquery.localScroll.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
<script>
$( function () {
$( "#toc" ).toc( {
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>