This commit is contained in:
Richard Davey
2013-09-01 22:02:42 +01:00
parent d31777972c
commit 6235f25184
5 changed files with 485 additions and 426 deletions
+31
View File
@@ -0,0 +1,31 @@
/**
* Phaser - LinkedList
*
* A miniature linked list class. Useful for optimizing time-critical or highly repetitive tasks!
*/
/**
* Creates a new link, and sets <code>object</code> and <code>next</code> to <code>null</code>.
*/
Phaser.LinkedList = function () {
this.object = null;
this.next = null;
};
Phaser.LinkedList.prototype = {
destroy: function () {
this.object = null;
if (this.next != null)
{
this.next.destroy();
}
this.next = null;
}
};
+34
View File
@@ -0,0 +1,34 @@
/**
* Phaser - QuadTree
*
* A fairly generic quad tree structure for rapid overlap checks. QuadTree is also configured for single or dual list operation.
* You can add items either to its A list or its B list. When you do an overlap check, you can compare the A list to itself,
* or the A list against the B list. Handy for different things!
*/
/**
* Instantiate a new Quad Tree node.
* @extends Rectangle
*
* @param {Number} x The X-coordinate of the point in space.
* @param {Number} y The Y-coordinate of the point in space.
* @param {Number} width Desired width of this node.
* @param {Number} height Desired height of this node.
* @param {Number} parent The parent branch or node. Pass null to create a root.
*/
Phaser.QuadTree = function (manager, x, y, width, height, parent) {
Phaser.Rectangle.call(this);
};
// constructor
Phaser.QuadTree.prototype = Object.create(Phaser.Rectangle.prototype);
Phaser.QuadTree.prototype.constructor = Phaser.Rectangle;
Phaser.QuadTree.prototype = {
};