Patched the QuadTree, now working a whole lot better but am worried it's still working out too many collisions.

This commit is contained in:
Richard Davey
2013-09-04 04:54:43 +01:00
parent 3f3b6bfd35
commit b2263c16c6
3 changed files with 84 additions and 26 deletions
+25
View File
@@ -105,6 +105,31 @@ Phaser.Utils.Debug.prototype = {
},
renderQuadTree: function (quadtree, color) {
color = color || 'rgba(255,0,0,0.3)';
this.start();
var bounds = quadtree.bounds;
if (quadtree.nodes.length === 0)
{
this.context.strokeStyle = color;
this.context.strokeRect(bounds.x, bounds.y, bounds.width, bounds.height);
}
else
{
for (var i = 0; i < quadtree.nodes.length; i++)
{
this.renderQuadTree(quadtree.nodes[i]);
}
}
this.stop();
},
renderSpriteCorners: function (sprite, showText, showBounds, color) {
if (this.context == null)