Skip to content

Commit d9323de

Browse files
committed
Docs and Examples update.
1 parent 1d633a5 commit d9323de

182 files changed

Lines changed: 5724 additions & 1156 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Bug Fixes:
7878
* Added missing return value in Body.hitLeft and hitRight, fixes issue #398 (thanks ram64).
7979
* Fixed easing tween example case. Issue #379 (thanks wesleywerner)
8080
* Removed SAT.js UMD wrapped, fixes issue #361 (thanks luizbills)
81+
* Removed inContact check from Body.separate.
8182

8283

8384
See the full Change Log for all the 1.1.4 updates and API changes (as there were a lot of them!)

build/phaser.js

Lines changed: 275 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* Phaser - http://www.phaser.io
2020
*
21-
* v1.1.5 - Built at: Wed Feb 12 2014 15:08:44
21+
* v1.1.5 - Built at: Wed Feb 12 2014 15:20:51
2222
*
2323
* By Richard Davey http://www.photonstorm.com @photonstorm
2424
*
@@ -29068,6 +29068,271 @@ Phaser.Polygon.prototype.constructor = Phaser.Polygon;
2906829068
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
2906929069
*/
2907029070

29071+
/**
29072+
* Creates a new Line object with a start and an end point.
29073+
* @class Line
29074+
* @classdesc Phaser - Line
29075+
* @constructor
29076+
* @param {number} [x1=0] - The x coordinate of the start of the line.
29077+
* @param {number} [y1=0] - The y coordinate of the start of the line.
29078+
* @param {number} [x2=0] - The x coordinate of the end of the line.
29079+
* @param {number} [y2=0] - The y coordinate of the end of the line.
29080+
* @return {Phaser.Line} This line object
29081+
*/
29082+
Phaser.Line = function (x1, y1, x2, y2) {
29083+
29084+
x1 = x1 || 0;
29085+
y1 = y1 || 0;
29086+
x2 = x2 || 0;
29087+
y2 = y2 || 0;
29088+
29089+
/**
29090+
* @property {Phaser.Point} start - The start point of the line.
29091+
*/
29092+
this.start = new Phaser.Point(x1, y1);
29093+
29094+
/**
29095+
* @property {Phaser.Point} end - The end point of the line.
29096+
*/
29097+
this.end = new Phaser.Point(x2, y2);
29098+
29099+
};
29100+
29101+
Phaser.Line.prototype = {
29102+
29103+
/**
29104+
* Sets the components of the Line to the specified values.
29105+
* @method Phaser.Line#setTo
29106+
* @param {number} [x1=0] - The x coordinate of the start of the line.
29107+
* @param {number} [y1=0] - The y coordinate of the start of the line.
29108+
* @param {number} [x2=0] - The x coordinate of the end of the line.
29109+
* @param {number} [y2=0] - The y coordinate of the end of the line.
29110+
* @return {Phaser.Line} This line object
29111+
*/
29112+
setTo: function (x1, y1, x2, y2) {
29113+
29114+
this.start.setTo(x1, y1);
29115+
this.end.setTo(x2, y2);
29116+
29117+
return this;
29118+
29119+
},
29120+
29121+
/**
29122+
* Sets the line to match the x/y coordinates of the two given sprites.
29123+
* Can optionally be calculated from their center coordinates.
29124+
* @method Phaser.Line#fromSprite
29125+
* @param {Phaser.Sprite} startSprite - The coordinates of this Sprite will be set to the Line.start point.
29126+
* @param {Phaser.Sprite} endSprite - The coordinates of this Sprite will be set to the Line.start point.
29127+
* @param {boolean} [useCenter=true] - If true it will use startSprite.center.x, if false startSprite.x.
29128+
* @return {Phaser.Line} This line object
29129+
*/
29130+
fromSprite: function (startSprite, endSprite, useCenter) {
29131+
29132+
if (typeof useCenter === 'undefined') { useCenter = true; }
29133+
29134+
if (useCenter)
29135+
{
29136+
return this.setTo(startSprite.center.x, startSprite.center.y, endSprite.center.x, endSprite.center.y);
29137+
}
29138+
else
29139+
{
29140+
return this.setTo(startSprite.x, startSprite.y, endSprite.x, endSprite.y);
29141+
}
29142+
29143+
},
29144+
29145+
/**
29146+
* Checks for intersection between this line and another Line.
29147+
* If asSegment is true it will check for segment intersection. If asSegment is false it will check for line intersection.
29148+
* Returns the intersection segment of AB and EF as a Point, or null if there is no intersection.
29149+
*
29150+
* @method Phaser.Line#intersects
29151+
* @param {Phaser.Line} line - The line to check against this one.
29152+
* @param {boolean} [asSegment=true] - If true it will check for segment intersection, otherwise full line intersection.
29153+
* @param {Phaser.Point} [result] - A Point object to store the result in, if not given a new one will be created.
29154+
* @return {Phaser.Point} The intersection segment of the two lines as a Point, or null if there is no intersection.
29155+
*/
29156+
intersects: function (line, asSegment, result) {
29157+
29158+
return Phaser.Line.intersectsPoints(this.start, this.end, line.start, line.end, asSegment, result);
29159+
29160+
},
29161+
29162+
/**
29163+
* Tests if the given coordinates fall on this line. See pointOnSegment to test against just the line segment.
29164+
* @method Phaser.Line#pointOnLine
29165+
* @param {number} x - The line to check against this one.
29166+
* @param {number} y - The line to check against this one.
29167+
* @return {boolean} True if the point is on the line, false if not.
29168+
*/
29169+
pointOnLine: function (x, y) {
29170+
29171+
return ((x - this.start.x) * (this.end.y - this.end.y) === (this.end.x - this.start.x) * (y - this.end.y));
29172+
29173+
},
29174+
29175+
/**
29176+
* Tests if the given coordinates fall on this line and within the segment. See pointOnLine to test against just the line.
29177+
* @method Phaser.Line#pointOnSegment
29178+
* @param {number} x - The line to check against this one.
29179+
* @param {number} y - The line to check against this one.
29180+
* @return {boolean} True if the point is on the line and segment, false if not.
29181+
*/
29182+
pointOnSegment: function (x, y) {
29183+
29184+
var xMin = Math.min(this.start.x, this.end.x);
29185+
var xMax = Math.max(this.start.x, this.end.x);
29186+
var yMin = Math.min(this.start.y, this.end.y);
29187+
var yMax = Math.max(this.start.y, this.end.y);
29188+
29189+
return (this.pointOnLine(x, y) && (x >= xMin && x <= xMax) && (y >= yMin && y <= yMax));
29190+
29191+
}
29192+
29193+
};
29194+
29195+
/**
29196+
* @name Phaser.Line#length
29197+
* @property {number} length - Gets the length of the line segment.
29198+
* @readonly
29199+
*/
29200+
Object.defineProperty(Phaser.Line.prototype, "length", {
29201+
29202+
get: function () {
29203+
return Math.sqrt((this.end.x - this.start.x) * (this.end.x - this.start.x) + (this.end.y - this.start.y) * (this.end.y - this.start.y));
29204+
}
29205+
29206+
});
29207+
29208+
/**
29209+
* @name Phaser.Line#angle
29210+
* @property {number} angle - Gets the angle of the line.
29211+
* @readonly
29212+
*/
29213+
Object.defineProperty(Phaser.Line.prototype, "angle", {
29214+
29215+
get: function () {
29216+
return Math.atan2(this.end.x - this.start.x, this.end.y - this.start.y);
29217+
}
29218+
29219+
});
29220+
29221+
/**
29222+
* @name Phaser.Line#slope
29223+
* @property {number} slope - Gets the slope of the line (y/x).
29224+
* @readonly
29225+
*/
29226+
Object.defineProperty(Phaser.Line.prototype, "slope", {
29227+
29228+
get: function () {
29229+
return (this.end.y - this.start.y) / (this.end.x - this.start.x);
29230+
}
29231+
29232+
});
29233+
29234+
/**
29235+
* @name Phaser.Line#perpSlope
29236+
* @property {number} perpSlope - Gets the perpendicular slope of the line (x/y).
29237+
* @readonly
29238+
*/
29239+
Object.defineProperty(Phaser.Line.prototype, "perpSlope", {
29240+
29241+
get: function () {
29242+
return -((this.end.x - this.start.x) / (this.end.y - this.start.y));
29243+
}
29244+
29245+
});
29246+
29247+
/**
29248+
* Checks for intersection between two lines as defined by the given start and end points.
29249+
* If asSegment is true it will check for line segment intersection. If asSegment is false it will check for line intersection.
29250+
* Returns the intersection segment of AB and EF as a Point, or null if there is no intersection.
29251+
* Adapted from code by Keith Hair
29252+
*
29253+
* @method Phaser.Line.intersects
29254+
* @param {Phaser.Point} a - The start of the first Line to be checked.
29255+
* @param {Phaser.Point} b - The end of the first line to be checked.
29256+
* @param {Phaser.Point} e - The start of the second Line to be checked.
29257+
* @param {Phaser.Point} f - The end of the second line to be checked.
29258+
* @param {boolean} [asSegment=true] - If true it will check for segment intersection, otherwise full line intersection.
29259+
* @param {Phaser.Point} [result] - A Point object to store the result in, if not given a new one will be created.
29260+
* @return {Phaser.Point} The intersection segment of the two lines as a Point, or null if there is no intersection.
29261+
*/
29262+
Phaser.Line.intersectsPoints = function (a, b, e, f, asSegment, result) {
29263+
29264+
if (typeof asSegment === 'undefined') { asSegment = true; }
29265+
if (typeof result === 'undefined') { result = new Phaser.Point(); }
29266+
29267+
var a1 = b.y - a.y;
29268+
var a2 = f.y - e.y;
29269+
var b1 = a.x - b.x;
29270+
var b2 = e.x - f.x;
29271+
var c1 = (b.x * a.y) - (a.x * b.y);
29272+
var c2 = (f.x * e.y) - (e.x * f.y);
29273+
var denom = (a1 * b2) - (a2 * b1);
29274+
29275+
if (denom === 0)
29276+
{
29277+
return null;
29278+
}
29279+
29280+
result.x = ((b1 * c2) - (b2 * c1)) / denom;
29281+
result.y = ((a2 * c1) - (a1 * c2)) / denom;
29282+
29283+
if (asSegment)
29284+
{
29285+
if (Math.pow((result.x - b.x) + (result.y - b.y), 2) > Math.pow((a.x - b.x) + (a.y - b.y), 2))
29286+
{
29287+
return null;
29288+
}
29289+
29290+
if (Math.pow((result.x - a.x) + (result.y - a.y), 2) > Math.pow((a.x - b.x) + (a.y - b.y), 2))
29291+
{
29292+
return null;
29293+
}
29294+
29295+
if (Math.pow((result.x - f.x) + (result.y - f.y), 2) > Math.pow((e.x - f.x) + (e.y - f.y), 2))
29296+
{
29297+
return null;
29298+
}
29299+
29300+
if (Math.pow((result.x - e.x) + (result.y - e.y), 2) > Math.pow((e.x - f.x) + (e.y - f.y), 2))
29301+
{
29302+
return null;
29303+
}
29304+
}
29305+
29306+
return result;
29307+
29308+
};
29309+
29310+
/**
29311+
* Checks for intersection between two lines.
29312+
* If asSegment is true it will check for segment intersection.
29313+
* If asSegment is false it will check for line intersection.
29314+
* Returns the intersection segment of AB and EF as a Point, or null if there is no intersection.
29315+
* Adapted from code by Keith Hair
29316+
*
29317+
* @method Phaser.Line.intersects
29318+
* @param {Phaser.Line} a - The first Line to be checked.
29319+
* @param {Phaser.Line} b - The second Line to be checked.
29320+
* @param {boolean} [asSegment=true] - If true it will check for segment intersection, otherwise full line intersection.
29321+
* @param {Phaser.Point} [result] - A Point object to store the result in, if not given a new one will be created.
29322+
* @return {Phaser.Point} The intersection segment of the two lines as a Point, or null if there is no intersection.
29323+
*/
29324+
Phaser.Line.intersects = function (a, b, asSegment, result) {
29325+
29326+
return Phaser.Line.intersectsPoints(a.start, a.end, b.start, b.end, asSegment, result);
29327+
29328+
};
29329+
29330+
/**
29331+
* @author Richard Davey <rich@photonstorm.com>
29332+
* @copyright 2014 Photon Storm Ltd.
29333+
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
29334+
*/
29335+
2907129336
/**
2907229337
* Phaser.Net handles browser URL related tasks such as checking host names, domain names and query string manipulation.
2907329338
*
@@ -41133,10 +41398,10 @@ Phaser.Physics.Arcade.Body.prototype = {
4113341398
*/
4113441399
separate: function (body, response) {
4113541400

41136-
if (this.inContact(body))
41137-
{
41138-
return false;
41139-
}
41401+
// if (this.inContact(body))
41402+
// {
41403+
// return false;
41404+
// }
4114041405

4114141406
this._distances[0] = body.right - this.x; // Distance of B to face on left side of A
4114241407
this._distances[1] = this.right - body.x; // Distance of B to face on right side of A
@@ -41195,10 +41460,10 @@ Phaser.Physics.Arcade.Body.prototype = {
4119541460
else
4119641461
{
4119741462
// They can only contact like this if at least one of their sides is open, otherwise it's a separation
41198-
// if (!this.checkCollision.up || !this.checkCollision.down || !this.checkCollision.left || !this.checkCollision.right || !body.checkCollision.up || !body.checkCollision.down || !body.checkCollision.left || !body.checkCollision.right)
41199-
// {
41463+
if (!this.checkCollision.up || !this.checkCollision.down || !this.checkCollision.left || !this.checkCollision.right || !body.checkCollision.up || !body.checkCollision.down || !body.checkCollision.left || !body.checkCollision.right)
41464+
{
4120041465
this.addContact(body);
41201-
// }
41466+
}
4120241467
}
4120341468

4120441469
return hasSeparated;
@@ -43718,8 +43983,8 @@ Phaser.Tilemap.prototype = {
4371843983
}
4371943984

4372043985
// Find out the difference between tileblock[1].x/y and x/y and use it as an offset, as it's the top left of the block to paste
43721-
var diffX = tileblock[1].x - x;
43722-
var diffY = tileblock[1].y - y;
43986+
var diffX = x - tileblock[1].x;
43987+
var diffY = y - tileblock[1].y;
4372343988

4372443989
for (var i = 1; i < tileblock.length; i++)
4372543990
{

build/phaser.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Animation.js.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,20 @@
398398
</ul>
399399
</li>
400400

401+
<li class="dropdown">
402+
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
403+
class="caret"></b></a>
404+
405+
<ul class="dropdown-menu ">
406+
407+
<li>
408+
<a href="global.html#SAT">SAT</a>
409+
</li>
410+
411+
412+
</ul>
413+
</li>
414+
401415
</ul>
402416
</div>
403417
</div>
@@ -909,7 +923,7 @@ <h1 class="page-title">Source: animation/Animation.js</h1>
909923

910924
<span class="jsdoc-message">
911925
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
912-
on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
926+
on Wed Feb 12 2014 15:23:36 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
913927
</span>
914928
</footer>
915929
</div>

0 commit comments

Comments
 (0)