mirror of
https://github.com/wassname/phaser.git
synced 2026-08-11 11:23:06 +08:00
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:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user