Finally getting there! Body collision almost as good as it can be (without a full-on physics system). Just a few last tweaks to do.

This commit is contained in:
photonstorm
2014-01-21 16:12:50 +00:00
parent c9d07c7346
commit 15a002e720
11 changed files with 779 additions and 684 deletions
+34
View File
@@ -922,6 +922,40 @@ Phaser.Utils.Debug.prototype = {
},
/**
* Renders the corners and point information of the given Sprite.
* @method Phaser.Utils.Debug#renderPolygon
* @param {array} polygon
* @param {string} [color='rgb(255,255,255)'] - The color the polygon is stroked in.
*/
renderPolygon: function (polygon, color, context) {
if (this.context === null && context === null)
{
return;
}
color = color || 'rgb(255,255,255)';
this.start(0, 0, color);
this.context.beginPath();
this.context.moveTo(polygon[0].x, polygon[0].y);
for (var i = 1; i < polygon.length; i++)
{
this.context.lineTo(polygon[i].x, polygon[i].y);
}
this.context.closePath();
// this.context.strokeStyle = 'rgba(255, 0, 255, 0.7)';
this.context.strokeStyle = color;
this.context.stroke();
this.stop();
},
/**
* Dumps the Linked List to the console.
*