Files
phaser/docs/Phaser.Physics.Arcade.html
T
2013-10-25 16:54:40 +01:00

6408 lines
97 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phaser 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</a>
<ul class="nav">
<li class="dropdown">
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="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.AnimationManager.html">AnimationManager</a>
</li>
<li>
<a href="Phaser.AnimationParser.html">AnimationParser</a>
</li>
<li>
<a href="Phaser.BitmapText.html">BitmapText</a>
</li>
<li>
<a href="Phaser.Bullet.html">Bullet</a>
</li>
<li>
<a href="Phaser.Button.html">Button</a>
</li>
<li>
<a href="Phaser.Cache.html">Cache</a>
</li>
<li>
<a href="Phaser.Camera.html">Camera</a>
</li>
<li>
<a href="Phaser.Canvas.html">Canvas</a>
</li>
<li>
<a href="Phaser.Circle.html">Circle</a>
</li>
<li>
<a href="Phaser.Color.html">Color</a>
</li>
<li>
<a href="Phaser.Device.html">Device</a>
</li>
<li>
<a href="Phaser.Easing.html">Easing</a>
</li>
<li>
<a href="Phaser.Easing.Back.html">Back</a>
</li>
<li>
<a href="Phaser.Easing.Bounce.html">Bounce</a>
</li>
<li>
<a href="Phaser.Easing.Circular.html">Circular</a>
</li>
<li>
<a href="Phaser.Easing.Cubic.html">Cubic</a>
</li>
<li>
<a href="Phaser.Easing.Elastic.html">Elastic</a>
</li>
<li>
<a href="Phaser.Easing.Exponential.html">Exponential</a>
</li>
<li>
<a href="Phaser.Easing.Linear.html">Linear</a>
</li>
<li>
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
</li>
<li>
<a href="Phaser.Easing.Quartic.html">Quartic</a>
</li>
<li>
<a href="Phaser.Easing.Quintic.html">Quintic</a>
</li>
<li>
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
</li>
<li>
<a href="Phaser.Events.html">Events</a>
</li>
<li>
<a href="Phaser.Frame.html">Frame</a>
</li>
<li>
<a href="Phaser.FrameData.html">FrameData</a>
</li>
<li>
<a href="Phaser.Game.html">Game</a>
</li>
<li>
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
</li>
<li>
<a href="Phaser.Graphics.html">Graphics</a>
</li>
<li>
<a href="Phaser.Group.html">Group</a>
</li>
<li>
<a href="Phaser.Input.html">Input</a>
</li>
<li>
<a href="Phaser.InputHandler.html">InputHandler</a>
</li>
<li>
<a href="Phaser.Key.html">Key</a>
</li>
<li>
<a href="Phaser.Keyboard.html">Keyboard</a>
</li>
<li>
<a href="Phaser.LinkedList.html">LinkedList</a>
</li>
<li>
<a href="Phaser.Loader.html">Loader</a>
</li>
<li>
<a href="Phaser.LoaderParser.html">LoaderParser</a>
</li>
<li>
<a href="Phaser.Math.html">Math</a>
</li>
<li>
<a href="Phaser.Mouse.html">Mouse</a>
</li>
<li>
<a href="Phaser.MSPointer.html">MSPointer</a>
</li>
<li>
<a href="Phaser.Net.html">Net</a>
</li>
<li>
<a href="Phaser.Particles.html">Particles</a>
</li>
<li>
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
</li>
<li>
<a href="Phaser.Physics.html">Physics</a>
</li>
<li>
<a href="Phaser.Physics.Arcade.html">Arcade</a>
</li>
<li>
<a href="Phaser.Plugin.html">Plugin</a>
</li>
<li>
<a href="Phaser.PluginManager.html">PluginManager</a>
</li>
<li>
<a href="Phaser.Point.html">Point</a>
</li>
<li>
<a href="Phaser.Pointer.html">Pointer</a>
</li>
<li>
<a href="Phaser.QuadTree.html">QuadTree</a>
</li>
<li>
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
</li>
<li>
<a href="Phaser.Rectangle.html">Rectangle</a>
</li>
<li>
<a href="Phaser.RenderTexture.html">RenderTexture</a>
</li>
<li>
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
</li>
<li>
<a href="Phaser.Signal.html">Signal</a>
</li>
<li>
<a href="Phaser.Sound.html">Sound</a>
</li>
<li>
<a href="Phaser.SoundManager.html">SoundManager</a>
</li>
<li>
<a href="Phaser.Sprite.html">Sprite</a>
</li>
<li>
<a href="Phaser.Stage.html">Stage</a>
</li>
<li>
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
</li>
<li>
<a href="Phaser.State.html">State</a>
</li>
<li>
<a href="Phaser.StateManager.html">StateManager</a>
</li>
<li>
<a href="Phaser.Text.html">Text</a>
</li>
<li>
<a href="Phaser.TileSprite.html">TileSprite</a>
</li>
<li>
<a href="Phaser.Time.html">Time</a>
</li>
<li>
<a href="Phaser.Touch.html">Touch</a>
</li>
<li>
<a href="Phaser.Tween.html">Tween</a>
</li>
<li>
<a href="Phaser.TweenManager.html">TweenManager</a>
</li>
<li>
<a href="Phaser.Utils.html">Utils</a>
</li>
<li>
<a href="Phaser.Utils.Debug.html">Debug</a>
</li>
<li>
<a href="Phaser.World.html">World</a>
</li>
<li>
<a href="SignalBinding.html">SignalBinding</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="global.html#audio">audio</a>
</li>
<li>
<a href="global.html#bitmapText">bitmapText</a>
</li>
<li>
<a href="global.html#bottom">bottom</a>
</li>
<li>
<a href="global.html#button">button</a>
</li>
<li>
<a href="global.html#child">child</a>
</li>
<li>
<a href="global.html#emitter">emitter</a>
</li>
<li>
<a href="global.html#existing.">existing.</a>
</li>
<li>
<a href="global.html#graphics">graphics</a>
</li>
<li>
<a href="global.html#group">group</a>
</li>
<li>
<a href="global.html#HEXtoRGB">HEXtoRGB</a>
</li>
<li>
<a href="global.html#renderTexture">renderTexture</a>
</li>
<li>
<a href="global.html#right">right</a>
</li>
<li>
<a href="global.html#sprite">sprite</a>
</li>
<li>
<a href="global.html#text">text</a>
</li>
<li>
<a href="global.html#tilemap">tilemap</a>
</li>
<li>
<a href="global.html#tilemaplayer">tilemaplayer</a>
</li>
<li>
<a href="global.html#tileset">tileset</a>
</li>
<li>
<a href="global.html#tileSprite">tileSprite</a>
</li>
<li>
<a href="global.html#tween">tween</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.html">Phaser</a><a href="Phaser.Physics.html">.Physics</a>.</span>
Arcade
</h2>
<div class="class-description"><p>Arcade 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>Arcade 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"><a href="Phaser.Game.html">Phaser.Game</a></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="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-20">line 20</a>
</li></ul></dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<dt>
<h4 class="name" id="maxLevels"><span class="type-signature"></span>maxLevels<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>Used by the QuadTree to set the maximum number of levels</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-37">line 37</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="maxObjects"><span class="type-signature"></span>maxObjects<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>Used by the QuadTree to set the maximum number of objects</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-31">line 31</a>
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="accelerateToObject"><span class="type-signature"></span>accelerateToObject<span class="signature">(displayObject, destination, <span class="optional">speed</span>, <span class="optional">xSpeedMax</span>, <span class="optional">ySpeedMax</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Sets the acceleration.x/y property on the display object so it will move towards the target at the given speed (in pixels per second sq.)
You must give a maximum speed value, beyond which the display object won't go any faster.
Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course.
Note: The display object doesn't stop moving once it reaches the destination coordinates.</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>displayObject</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The display object to move.</p></td>
</tr>
<tr>
<td class="name"><code>destination</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The display object to move towards. Can be any object but must have visible x/y properties.</p></td>
</tr>
<tr>
<td class="name"><code>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The speed it will accelerate in pixels per second.</p></td>
</tr>
<tr>
<td class="name"><code>xSpeedMax</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
500
</td>
<td class="description last"><p>The maximum x velocity the display object can reach.</p></td>
</tr>
<tr>
<td class="name"><code>ySpeedMax</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
500
</td>
<td class="description last"><p>The maximum y velocity the display object can reach.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1072">line 1072</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The angle (in radians) that the object should be visually set to in order to match its new trajectory.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="accelerateToPointer"><span class="type-signature"></span>accelerateToPointer<span class="signature">(displayObject, <span class="optional">pointer</span>, <span class="optional">speed</span>, <span class="optional">xSpeedMax</span>, <span class="optional">ySpeedMax</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Sets the acceleration.x/y property on the display object so it will move towards the target at the given speed (in pixels per second sq.)
You must give a maximum speed value, beyond which the display object won't go any faster.
Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course.
Note: The display object doesn't stop moving once it reaches the destination coordinates.</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>displayObject</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The display object to move.</p></td>
</tr>
<tr>
<td class="name"><code>pointer</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Pointer.html">Phaser.Pointer</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The pointer to move towards. Defaults to Phaser.Input.activePointer.</p></td>
</tr>
<tr>
<td class="name"><code>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The speed it will accelerate in pixels per second.</p></td>
</tr>
<tr>
<td class="name"><code>xSpeedMax</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
500
</td>
<td class="description last"><p>The maximum x velocity the display object can reach.</p></td>
</tr>
<tr>
<td class="name"><code>ySpeedMax</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
500
</td>
<td class="description last"><p>The maximum y velocity the display object can reach.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1101">line 1101</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The angle (in radians) that the object should be visually set to in order to match its new trajectory.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="accelerateToXY"><span class="type-signature"></span>accelerateToXY<span class="signature">(displayObject, x, y, <span class="optional">speed</span>, <span class="optional">xSpeedMax</span>, <span class="optional">ySpeedMax</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Sets the acceleration.x/y property on the display object so it will move towards the x/y coordinates at the given speed (in pixels per second sq.)
You must give a maximum speed value, beyond which the display object won't go any faster.
Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course.
Note: The display object doesn't stop moving once it reaches the destination coordinates.</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>displayObject</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The display object to move.</p></td>
</tr>
<tr>
<td class="name"><code>x</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>The x coordinate to accelerate towards.</p></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The y coordinate to accelerate towards.</p></td>
</tr>
<tr>
<td class="name"><code>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The speed it will accelerate in pixels per second.</p></td>
</tr>
<tr>
<td class="name"><code>xSpeedMax</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
500
</td>
<td class="description last"><p>The maximum x velocity the display object can reach.</p></td>
</tr>
<tr>
<td class="name"><code>ySpeedMax</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
500
</td>
<td class="description last"><p>The maximum y velocity the display object can reach.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1131">line 1131</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The angle (in radians) that the object should be visually set to in order to match its new trajectory.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="accelerationFromRotation"><span class="type-signature"></span>accelerationFromRotation<span class="signature">(rotation, <span class="optional">speed</span>, <span class="optional">point</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Point.html">Phaser.Point</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Given the rotation (in radians) and speed calculate the acceleration and return it as a Point object, or set it to the given point object.
One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) which will set the values directly to the sprites velocity and not create a new Point object.</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>rotation</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>The angle in radians.</p></td>
</tr>
<tr>
<td class="name"><code>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The speed it will move, in pixels per second sq.</p></td>
</tr>
<tr>
<td class="name"><code>point</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span>
|
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The Point object in which the x and y properties will be set to the calculated acceleration.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1053">line 1053</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>A Point where point.x contains the acceleration x value and point.y contains the acceleration y value.</li>
</ul>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="angleBetween"><span class="type-signature"></span>angleBetween<span class="signature">(source, target)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Find the angle in radians 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="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1219">line 1219</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The angle in radians between the source and target display objects.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="angleToPointer"><span class="type-signature"></span>angleToPointer<span class="signature">(displayObject, <span class="optional">pointer</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Find the angle in radians between a display object (like a Sprite) and a Pointer, taking their x/y and center into account.</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>displayObject</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The Display Object to test from.</p></td>
</tr>
<tr>
<td class="name"><code>pointer</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Pointer.html">Phaser.Pointer</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The Phaser.Pointer to test to. If none is given then Input.activePointer is used.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1254">line 1254</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The angle in radians between displayObject.x/y to Pointer.x/y</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="angleToXY"><span class="type-signature"></span>angleToXY<span class="signature">(displayObject, x, y)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Find the angle in radians between a display object (like a Sprite) and the given x/y coordinate.</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 get the angle 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 get the angle 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="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1236">line 1236</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The angle in radians between displayObject.x/y to Pointer.x/y</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<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; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Checks for collision between two game objects. The objects can be Sprites, Groups, Emitters or Tilemaps.
You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap or Group vs. Tilemap collisions.
The objects are also automatically separated.</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.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Group.html">Phaser.Group</a></span>
|
<span class="param-type">Phaser.Particles.Emitter</span>
|
<span class="param-type">Phaser.Tilemap</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.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.Tilemap</p></td>
</tr>
<tr>
<td class="name"><code>object2</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Group.html">Phaser.Group</a></span>
|
<span class="param-type">Phaser.Particles.Emitter</span>
|
<span class="param-type">Phaser.Tilemap</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.Tilemap</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 overlap. The two objects will be passed to this function in the same order in which you passed them to Collision.overlap.</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 collideCallback 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="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-207">line 207</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The number of collisions that were processed.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="computeVelocity"><span class="type-signature"></span>computeVelocity<span class="signature">(axis, body, velocity, acceleration, drag, mMax)</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.</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>axis</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>1 for horizontal, 2 for vertical.</p></td>
</tr>
<tr>
<td class="name"><code>body</code></td>
<td class="type">
<span class="param-type">Phaser.Physics.Arcade.Body</span>
</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="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="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="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>mMax</code></td>
<td class="type">
<span class="param-type">number</span>
</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="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-97">line 97</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="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1161">line 1161</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="distanceToPointer"><span class="type-signature"></span>distanceToPointer<span class="signature">(displayObject, <span class="optional">pointer</span>)</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 a Pointer. If no Pointer is given the Input.activePointer is used.
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>Argument</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="attributes">
</td>
<td class="description last"><p>The Display Object to test from.</p></td>
</tr>
<tr>
<td class="name"><code>pointer</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Pointer.html">Phaser.Pointer</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The Phaser.Pointer to test to. If none is given then Input.activePointer is used.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1198">line 1198</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The distance between the object and the Pointer.</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.
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 move towards.</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 move towards.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1178">line 1178</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="moveToObject"><span class="type-signature"></span>moveToObject<span class="signature">(displayObject, destination, <span class="optional">speed</span>, <span class="optional">maxTime</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Move the given display object towards the destination object at a steady velocity.
If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
Timings are approximate due to the way browser timers work. Allow for a variance of +- 50ms.
Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course.
Note: The display object doesn't stop moving once it reaches the destination coordinates.
Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set drag or acceleration too high this object may not move at all)</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>displayObject</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The display object to move.</p></td>
</tr>
<tr>
<td class="name"><code>destination</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The display object to move towards. Can be any object but must have visible x/y properties.</p></td>
</tr>
<tr>
<td class="name"><code>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The speed it will move, in pixels per second (default is 60 pixels/sec)</p></td>
</tr>
<tr>
<td class="name"><code>maxTime</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the object will arrive at destination in the given number of ms.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-909">line 909</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The angle (in radians) that the object should be visually set to in order to match its new velocity.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="moveToPointer"><span class="type-signature"></span>moveToPointer<span class="signature">(displayObject, <span class="optional">speed</span>, <span class="optional">pointer</span>, <span class="optional">maxTime</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Move the given display object towards the pointer at a steady velocity. If no pointer is given it will use Phaser.Input.activePointer.
If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
Timings are approximate due to the way browser timers work. Allow for a variance of +- 50ms.
Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course.
Note: The display object doesn't stop moving once it reaches the destination coordinates.</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>displayObject</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The display object to move.</p></td>
</tr>
<tr>
<td class="name"><code>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The speed it will move, in pixels per second (default is 60 pixels/sec)</p></td>
</tr>
<tr>
<td class="name"><code>pointer</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Pointer.html">Phaser.Pointer</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The pointer to move towards. Defaults to Phaser.Input.activePointer.</p></td>
</tr>
<tr>
<td class="name"><code>maxTime</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the object will arrive at destination in the given number of ms.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-944">line 944</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The angle (in radians) that the object should be visually set to in order to match its new velocity.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="moveToXY"><span class="type-signature"></span>moveToXY<span class="signature">(displayObject, x, y, <span class="optional">speed</span>, <span class="optional">maxTime</span>)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Move the given display object towards the x/y coordinates at a steady velocity.
If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds.
Timings are approximate due to the way browser timers work. Allow for a variance of +- 50ms.
Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course.
Note: The display object doesn't stop moving once it reaches the destination coordinates.
Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set drag or acceleration too high this object may not move at all)</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>displayObject</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The display object to move.</p></td>
</tr>
<tr>
<td class="name"><code>x</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>The x coordinate to move towards.</p></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The y coordinate to move towards.</p></td>
</tr>
<tr>
<td class="name"><code>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The speed it will move, in pixels per second (default is 60 pixels/sec)</p></td>
</tr>
<tr>
<td class="name"><code>maxTime</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the object will arrive at destination in the given number of ms.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-979">line 979</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The angle (in radians) that the object should be visually set to in order to match its new velocity.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="overlap"><span class="type-signature"></span>overlap<span class="signature">(object1, object2)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Checks if two Sprite objects overlap.</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>object1</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
</td>
<td class="description last"><p>The first object to check. Can be an instance of Phaser.Sprite or anything that extends it.</p></td>
</tr>
<tr>
<td class="name"><code>object2</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
</td>
<td class="description last"><p>The second object to check. Can be an instance of Phaser.Sprite or anything that extends it.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-187">line 187</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>true if the two objects overlap.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="postUpdate"><span class="type-signature">&lt;protected> </span>postUpdate<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Called automatically by the core game loop.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-174">line 174</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="preUpdate"><span class="type-signature">&lt;protected> </span>preUpdate<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Called automatically by the core game loop.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-157">line 157</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="separate"><span class="type-signature"></span>separate<span class="signature">(body1, body2)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>The core separation function to separate two physics 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">Phaser.Physics.Arcade.Body</span>
</td>
<td class="description last"><p>The Body object to separate.</p></td>
</tr>
<tr>
<td class="name"><code>body2</code></td>
<td class="type">
<span class="param-type">Phaser.Physics.Arcade.Body</span>
</td>
<td class="description last"><p>The Body object to separate.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-486">line 486</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns true if the bodies were separated, otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="separateTile"><span class="type-signature"></span>separateTile<span class="signature">(body1, tile)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>The core separation function to separate a physics body and a tile.</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">Phaser.Physics.Arcade.Body</span>
</td>
<td class="description last"><p>The Body object to separate.</p></td>
</tr>
<tr>
<td class="name"><code>tile</code></td>
<td class="type">
<span class="param-type">Phaser.Tile</span>
</td>
<td class="description last"><p>The tile to collide against.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-728">line 728</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns true if the bodies were separated, otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="separateTileX"><span class="type-signature"></span>separateTileX<span class="signature">(body1, tile)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>The core separation function to separate a physics body and a tile on the x axis.</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">Phaser.Physics.Arcade.Body</span>
</td>
<td class="description last"><p>The Body object to separate.</p></td>
</tr>
<tr>
<td class="name"><code>tile</code></td>
<td class="type">
<span class="param-type">Phaser.Tile</span>
</td>
<td class="description last"><p>The tile to collide against.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-741">line 741</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns true if the bodies were separated, otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="separateTileY"><span class="type-signature"></span>separateTileY<span class="signature">(body1, tile)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>The core separation function to separate a physics body and a tile on the x axis.</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">Phaser.Physics.Arcade.Body</span>
</td>
<td class="description last"><p>The Body object to separate.</p></td>
</tr>
<tr>
<td class="name"><code>tile</code></td>
<td class="type">
<span class="param-type">Phaser.Tile</span>
</td>
<td class="description last"><p>The tile to collide against.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-825">line 825</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns true if the bodies were separated, otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="separateX"><span class="type-signature"></span>separateX<span class="signature">(body1, body2)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>The core separation function to separate two physics bodies on the x axis.</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">Phaser.Physics.Arcade.Body</span>
</td>
<td class="description last"><p>The Body object to separate.</p></td>
</tr>
<tr>
<td class="name"><code>body2</code></td>
<td class="type">
<span class="param-type">Phaser.Physics.Arcade.Body</span>
</td>
<td class="description last"><p>The Body object to separate.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-499">line 499</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns true if the bodies were separated, otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="separateY"><span class="type-signature"></span>separateY<span class="signature">(body1, body2)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>The core separation function to separate two physics bodies on the y axis.</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">Phaser.Physics.Arcade.Body</span>
</td>
<td class="description last"><p>The Body object to separate.</p></td>
</tr>
<tr>
<td class="name"><code>body2</code></td>
<td class="type">
<span class="param-type">Phaser.Physics.Arcade.Body</span>
</td>
<td class="description last"><p>The Body object to separate.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-607">line 607</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns true if the bodies were separated, otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="updateMotion"><span class="type-signature"></span>updateMotion<span class="signature">(The)</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>The</code></td>
<td class="type">
<span class="param-type">Phaser.Physics.Arcade.Body</span>
</td>
<td class="description last"><p>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="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-67">line 67</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="velocityFromAngle"><span class="type-signature"></span>velocityFromAngle<span class="signature">(angle, <span class="optional">speed</span>, <span class="optional">point</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Point.html">Phaser.Point</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Given the angle (in degrees) and speed calculate the velocity and return it as a Point object, or set it to the given point object.
One way to use this is: velocityFromAngle(angle, 200, sprite.velocity) which will set the values directly to the sprites velocity and not create a new Point object.</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>angle</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>The angle in degrees calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative)</p></td>
</tr>
<tr>
<td class="name"><code>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The speed it will move, in pixels per second sq.</p></td>
</tr>
<tr>
<td class="name"><code>point</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span>
|
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The Point object in which the x and y properties will be set to the calculated 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="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1015">line 1015</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>A Point where point.x contains the velocity x value and point.y contains the velocity y value.</li>
</ul>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="velocityFromRotation"><span class="type-signature"></span>velocityFromRotation<span class="signature">(rotation, <span class="optional">speed</span>, <span class="optional">point</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Point.html">Phaser.Point</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Given the rotation (in radians) and speed calculate the velocity and return it as a Point object, or set it to the given point object.
One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) which will set the values directly to the sprites velocity and not create a new Point object.</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>rotation</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>The angle in radians.</p></td>
</tr>
<tr>
<td class="name"><code>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The speed it will move, in pixels per second sq.</p></td>
</tr>
<tr>
<td class="name"><code>point</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span>
|
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The Point object in which the x and y properties will be set to the calculated 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="ArcadePhysics.js.html">physics/arcade/ArcadePhysics.js</a>, <a href="ArcadePhysics.js.html#sunlight-1-line-1034">line 1034</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>A Point where point.x contains the velocity x value and point.y contains the velocity y value.</li>
</ul>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></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.3.0-dev</a>
on Fri Oct 25 2013 16:16:47 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>
<div class="span3">
<div id="toc"></div>
</div>
<br clear="both">
</div>
</div>
<script src="scripts/sunlight.js"></script>
<script src="scripts/sunlight.javascript.js"></script>
<script src="scripts/sunlight-plugin.doclinks.js"></script>
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
<script src="scripts/sunlight-plugin.menu.js"></script>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/jquery.scrollTo.js"></script>
<script src="scripts/jquery.localScroll.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
<script>
$( function () {
$( "#toc" ).toc( {
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
</script>
</body>
</html>