Files
phaser-plugin-isometric/doc/Phaser.Plugin.Isometric.Arcade.html
T

4178 lines
56 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phaser Isometric Class: Arcade</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 Isometric</a>
<ul class="nav">
<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.Plugin.Isometric.html">Phaser.Plugin.Isometric</a>
</li>
<li>
<a href="Phaser.Plugin.Isometric.Arcade.html">Phaser.Plugin.Isometric.Arcade</a>
</li>
<li>
<a href="Phaser.Plugin.Isometric.Body.html">Phaser.Plugin.Isometric.Body</a>
</li>
<li>
<a href="Phaser.Plugin.Isometric.Cube.html">Phaser.Plugin.Isometric.Cube</a>
</li>
<li>
<a href="Phaser.Plugin.Isometric.IsoSprite.html">Phaser.Plugin.Isometric.IsoSprite</a>
</li>
<li>
<a href="Phaser.Plugin.Isometric.Octree.html">Phaser.Plugin.Isometric.Octree</a>
</li>
<li>
<a href="Phaser.Plugin.Isometric.Point3.html">Phaser.Plugin.Isometric.Point3</a>
</li>
<li>
<a href="Phaser.Plugin.Isometric.Projector.html">Phaser.Plugin.Isometric.Projector</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<div id="main">
<h1 class="page-title">Class: Arcade</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="Phaser.Plugin.Isometric.html">.Isometric</a>.</span>
Arcade
</h2>
<div class="class-description"><p>IsoArcade Physics Constructor</p></div>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="Arcade"><span class="type-signature"></span>new Arcade<span class="signature">(game)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>IsoArcade Physics constructor.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>game</code></td>
<td class="type">
<span class="param-type">Phaser.Game</span>
</td>
<td class="description last"><p>reference to the current game instance.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-9">line 9</a>
</li>
</ul>
</dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<dt class="name" id="bounds">
<h4><span class="type-signature"></span>bounds<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>bounds</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.Cube.html">Phaser.Plugin.Isometric.Cube</a></span>
</td>
<td class="description last"><p>The bounds inside of which the physics world exists. Defaults to match the world bounds relatively closely given the isometric projection.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-24">line 24</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="checkCollision">
<h4><span class="type-signature"></span>checkCollision<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Set the checkCollision properties to control for which bounds collision is processed.
For example checkCollision.down = false means Bodies cannot collide with the World.bounds.bottom.</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>checkCollision</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>An object containing allowed collision flags.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-31">line 31</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="forceXY">
<h4><span class="type-signature"></span>forceXY<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>forceX</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true World.separate will always separate on the X and Y axes before Z. Otherwise it will check gravity totals first.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-58">line 58</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="game">
<h4><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">Phaser.Game</span>
</td>
<td class="description last"><p>Local reference to game.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-14">line 14</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="gravity">
<h4><span class="type-signature"></span>gravity<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>gravity</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.Point3.html">Phaser.Plugin.Isometric.Point3</a></span>
</td>
<td class="description last"><p>The World gravity setting. Defaults to x: 0, y: 0, z: 0 or no gravity.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-19">line 19</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="maxLevels">
<h4><span class="type-signature"></span>maxLevels<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>maxLevels</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Used by the QuadTree/Octree to set the maximum number of iteration levels.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-48">line 48</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="maxObjects">
<h4><span class="type-signature"></span>maxObjects<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>maxObjects</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Used by the QuadTree/Octree to set the maximum number of objects per quad.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-43">line 43</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="octree">
<h4><span class="type-signature"></span>octree<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>octree</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.Octree.html">Phaser.Plugin.Isometric.Octree</a></span>
</td>
<td class="description last"><p>The world Octree.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-78">line 78</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="OVERLAP_BIAS">
<h4><span class="type-signature"></span>OVERLAP_BIAS<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>OVERLAP_BIAS</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>A value added to the delta values during collision checks.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-53">line 53</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="quadTree">
<h4><span class="type-signature"></span>quadTree<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>quadTree</code></td>
<td class="type">
<span class="param-type">Phaser.QuadTree</span>
</td>
<td class="description last"><p>The world QuadTree.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-73">line 73</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="skipTree">
<h4><span class="type-signature"></span>skipTree<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>skipTree</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true an Octree/QuadTree will never be used for any collision. Handy for tightly packed games. See also Body.skipTree.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-63">line 63</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt class="name" id="useQuadTree">
<h4><span class="type-signature"></span>useQuadTree<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>useQuadTree</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true, the collision/overlap routines will use a QuadTree, which will ignore the z position of objects when determining potential collisions. This will be faster if you don't do a lot of stuff on the z-axis.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-68">line 68</a>
</li>
</ul>
</dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="collide"><span class="type-signature"></span>collide<span class="signature">(object1, object2, <span class="optional">collideCallback</span>, <span class="optional">processCallback</span>, <span class="optional">callbackContext</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Checks for collision between two game objects. You can perform IsoSprite vs. IsoSprite, IsoSprite vs. Group or Group vs. Group collisions.
The second parameter can be an array of objects, of differing types.
The objects are also automatically separated. If you don't require separation then use IsoArcade.overlap instead.
An optional processCallback can be provided. If given this function will be called when two sprites are found to be colliding. It is called before any separation takes place,
giving you the chance to perform additional checks. If the function returns true then the collision and separation is carried out. If it returns false it is skipped.
The collideCallback is an optional function that is only called if two sprites collide. If a processCallback has been set then it needs to return true for collideCallback to be called.
NOTE: This function is not recursive, and will not test against children of objects passed (i.e. Groups within Groups).</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>object1</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.IsoSprite.html">Phaser.Plugin.Isometric.IsoSprite</a></span>
|
<span class="param-type">Phaser.Group</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The first object to check. Can be an instance of Phaser.Plugin.Isometric.IsoSprite or Phaser.Group.</p></td>
</tr>
<tr>
<td class="name"><code>object2</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.IsoSprite.html">Phaser.Plugin.Isometric.IsoSprite</a></span>
|
<span class="param-type">Phaser.Group</span>
|
<span class="param-type">array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The second object or array of objects to check. Can be Phaser.Plugin.Isometric.IsoSprite or Phaser.Group.</p></td>
</tr>
<tr>
<td class="name"><code>collideCallback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last"><p>An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them, unless you are colliding Group vs. Sprite, in which case Sprite will always be the first parameter.</p></td>
</tr>
<tr>
<td class="name"><code>processCallback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last"><p>A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collision will only happen if processCallback returns true. The two objects will be passed to this function in the same order in which you specified them.</p></td>
</tr>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The context in which to run the callbacks.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-364">line 364</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True if a collision occured otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="computeVelocity"><span class="type-signature"></span>computeVelocity<span class="signature">(axis, body, velocity, acceleration, drag, <span class="optional">max</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>A tween-like function that takes a starting velocity and some other factors and returns an altered velocity.
Based on a function in Flixel by @ADAMATOMIC</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>axis</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>0 for nothing, 1 for X-axis, 2 for Y-axis, 3 for vertical (Z-axis).</p></td>
</tr>
<tr>
<td class="name"><code>body</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.Body.html">Phaser.Plugin.Isometric.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The Body object to be updated.</p></td>
</tr>
<tr>
<td class="name"><code>velocity</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>Any component of velocity (e.g. 20).</p></td>
</tr>
<tr>
<td class="name"><code>acceleration</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>Rate at which the velocity is changing.</p></td>
</tr>
<tr>
<td class="name"><code>drag</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>Really kind of a deceleration, this is how much the velocity changes if Acceleration is not set.</p></td>
</tr>
<tr>
<td class="name"><code>max</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
10000
</td>
<td class="description last"><p>An absolute value cap for the velocity.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-279">line 279</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The altered Velocity value.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="distanceBetween"><span class="type-signature"></span>distanceBetween<span class="signature">(source, target)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Find the distance between two display objects (like Sprites).</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>source</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="description last"><p>The Display Object to test from.</p></td>
</tr>
<tr>
<td class="name"><code>target</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="description last"><p>The Display Object to test 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="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-959">line 959</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The distance between the source and target objects.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="distanceToXY"><span class="type-signature"></span>distanceToXY<span class="signature">(displayObject, x, y)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Find the distance between a display object (like a Sprite) and the given x/y coordinates only (ignore z).
The calculation is made from the display objects x/y coordinate. This may be the top-left if its anchor hasn't been changed.
If you need to calculate from the center of a display object instead use the method distanceBetweenCenters()</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>displayObject</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="description last"><p>The Display Object to test from.</p></td>
</tr>
<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 to test to.</p></td>
</tr>
<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 to test 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="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-977">line 977</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The distance between the object and the x/y coordinates.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="distanceToXYZ"><span class="type-signature"></span>distanceToXYZ<span class="signature">(displayObject, x, y, z)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Find the distance between a display object (like a Sprite) and the given x/y/z coordinates.
The calculation is made from the display objects x/y/z coordinate. This may be the top-left if its anchor hasn't been changed.
If you need to calculate from the center of a display object instead use the method distanceBetweenCenters()</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>displayObject</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="description last"><p>The Display Object to test from.</p></td>
</tr>
<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 to test to.</p></td>
</tr>
<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 to test to.</p></td>
</tr>
<tr>
<td class="name"><code>z</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The y coordinate to test 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="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-998">line 998</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The distance between the object and the x/y coordinates.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="enable"><span class="type-signature"></span>enable<span class="signature">(object, <span class="optional">children</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>This will create an IsoArcade Physics body on the given game object or array of game objects.
A game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.</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>object</code></td>
<td class="type">
<span class="param-type">object</span>
|
<span class="param-type">array</span>
|
<span class="param-type">Phaser.Group</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a <code>body</code> property.</p></td>
</tr>
<tr>
<td class="name"><code>children</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>Should a body be created on all children of this object? If true it will recurse down the display list as far as it can go.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-200">line 200</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="enableBody"><span class="type-signature"></span>enableBody<span class="signature">(object)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Creates an IsoArcade Physics body on the given game object.
A game object can only have 1 physics body active at any one time, and it can't be changed until the body is nulled.</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>object</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>The game object to create the physics body on. A body will only be created if this object has a null <code>body</code> property.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-246">line 246</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="intersects"><span class="type-signature"></span>intersects<span class="signature">(body1, body2)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Check for intersection against two bodies.</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>body1</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.Body.html">Phaser.Plugin.Isometric.Body</a></span>
</td>
<td class="description last"><p>The Body object to check.</p></td>
</tr>
<tr>
<td class="name"><code>body2</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.Body.html">Phaser.Plugin.Isometric.Body</a></span>
</td>
<td class="description last"><p>The Body object to check.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-623">line 623</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True if they intersect, otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="overlap"><span class="type-signature"></span>overlap<span class="signature">(object1, object2, <span class="optional">overlapCallback</span>, <span class="optional">processCallback</span>, <span class="optional">callbackContext</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Checks for overlaps between two game objects. The objects can be IsoSprites or Groups.
You can perform IsoSprite vs. IsoSprite, IsoSprite vs. Group and Group vs. Group overlap checks.
Unlike collide the objects are NOT automatically separated or have any physics applied, they merely test for overlap results.
The second parameter can be an array of objects, of differing types.
NOTE: This function is not recursive, and will not test against children of objects passed (i.e. Groups within Groups).</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>object1</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.IsoSprite.html">Phaser.Plugin.Isometric.IsoSprite</a></span>
|
<span class="param-type">Phaser.Group</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The first object to check. Can be an instance of Phaser.Plugin.Isometric.IsoSprite or Phaser.Group.</p></td>
</tr>
<tr>
<td class="name"><code>object2</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.IsoSprite.html">Phaser.Plugin.Isometric.IsoSprite</a></span>
|
<span class="param-type">Phaser.Group</span>
|
<span class="param-type">array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The second object or array of objects to check. Can be Phaser.Plugin.Isometric.IsoSprite or Phaser.Group.</p></td>
</tr>
<tr>
<td class="name"><code>overlapCallback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last"><p>An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them.</p></td>
</tr>
<tr>
<td class="name"><code>processCallback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last"><p>A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then overlapCallback will only be called if processCallback returns true.</p></td>
</tr>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The context in which to run the callbacks.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-328">line 328</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True if an overlap occured otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setBounds"><span class="type-signature"></span>setBounds<span class="signature">(x, y, z, widthX, widthY, height)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Updates the size of this physics world.</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>x</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Bottom rear most corner of the world.</p></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Bottom rear most corner of the world.</p></td>
</tr>
<tr>
<td class="name"><code>z</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Bottom rear most corner of the world.</p></td>
</tr>
<tr>
<td class="name"><code>widthX</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>New X width (breadth) of the world. Can never be smaller than the Game.width.</p></td>
</tr>
<tr>
<td class="name"><code>widthY</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>New Y width (depth) of the world. Can never be smaller than the Game.width.</p></td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>New height of the world. Can never be smaller than the Game.height.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-172">line 172</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setBoundsToWorld"><span class="type-signature"></span>setBoundsToWorld<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Updates the size of this physics world to match the size of the game world.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-189">line 189</a>
</li>
</ul>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="updateMotion"><span class="type-signature"></span>updateMotion<span class="signature">(body)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Called automatically by a Physics body, it updates all motion related values on the Body.</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>body</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Plugin.Isometric.Body.html">Phaser.Plugin.Isometric.Body</a></span>
</td>
<td class="description last"><p>The Body object to be updated.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="World.js.html">physics/World.js</a>,
<a href="World.js.html#sunlight-1-line-261">line 261</a>
</li>
</ul>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
Copyright © 2014 Lewis Lane - Rotates.org
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a>
on Wed Aug 6th 2014 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/docstrap.lib.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : "100px"
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
// $( ".tutorial-section pre, .readme-section pre" ).addClass( "sunlight-highlight-javascript" ).addClass( "linenums" );
$( ".tutorial-section pre, .readme-section pre" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
lang = "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
</body>
</html>