Skip to content

Commit 971f69c

Browse files
committed
New build files for final tests before release.
1 parent 0966971 commit 971f69c

11 files changed

Lines changed: 3060 additions & 2653 deletions

build/custom/ninja.js

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,28 @@ Object.defineProperty(Phaser.Physics.Ninja.Body.prototype, "angle", {
11531153

11541154
});
11551155

1156+
/**
1157+
* Render Sprite's Body.
1158+
*
1159+
* @method Phaser.Physics.Ninja.Body#render
1160+
* @param {object} context - The context to render to.
1161+
* @param {Phaser.Physics.Ninja.Body} body - The Body to render.
1162+
* @param {string} [color='rgba(0,255,0,0.4)'] - color of the debug shape to be rendered. (format is css color string).
1163+
* @param {boolean} [filled=true] - Render the shape as a filled (default, true) or a stroked (false)
1164+
*/
1165+
Phaser.Physics.Ninja.Body.render = function(context, body, color, filled) {
1166+
color = color || 'rgba(0,255,0,0.4)';
1167+
1168+
if (typeof filled === 'undefined')
1169+
{
1170+
filled = true;
1171+
}
1172+
1173+
if (body.aabb || body.circle)
1174+
{
1175+
body.shape.render(context, body.game.camera.x, body.game.camera.y, color, filled);
1176+
}
1177+
};
11561178

11571179
/* jshint camelcase: false */
11581180
/**
@@ -2159,8 +2181,33 @@ Phaser.Physics.Ninja.AABB.prototype = {
21592181
destroy: function() {
21602182
this.body = null;
21612183
this.system = null;
2162-
}
2184+
},
21632185

2186+
/**
2187+
* Render this AABB for debugging purposes.
2188+
*
2189+
* @method Phaser.Physics.Ninja.AABB#render
2190+
* @param {object} context - The context to render to.
2191+
* @param {number} xOffset - X offset from AABB's position to render at.
2192+
* @param {number} yOffset - Y offset from AABB's position to render at.
2193+
* @param {string} color - color of the debug shape to be rendered. (format is css color string).
2194+
* @param {boolean} filled - Render the shape as solid (true) or hollow (false).
2195+
*/
2196+
render: function(context, xOffset, yOffset, color, filled) {
2197+
var left = this.pos.x - this.xw - xOffset;
2198+
var top = this.pos.y - this.yw - yOffset;
2199+
2200+
if (filled)
2201+
{
2202+
context.fillStyle = color;
2203+
context.fillRect(left, top, this.width, this.height);
2204+
}
2205+
else
2206+
{
2207+
context.strokeStyle = color;
2208+
context.strokeRect(left, top, this.width, this.height);
2209+
}
2210+
}
21642211
};
21652212

21662213
/* jshint camelcase: false */
@@ -3266,7 +3313,6 @@ Phaser.Physics.Ninja.Circle.prototype = {
32663313
}
32673314
else
32683315
{
3269-
// console.log("ResolveCircleTile() was called with an empty (or unknown) tile!: ID=" + t.id + ")");
32703316
return false;
32713317
}
32723318

@@ -5557,6 +5603,34 @@ Phaser.Physics.Ninja.Circle.prototype = {
55575603
destroy: function() {
55585604
this.body = null;
55595605
this.system = null;
5560-
}
5606+
},
5607+
5608+
/**
5609+
* Render this circle for debugging purposes.
5610+
*
5611+
* @method Phaser.Physics.Ninja.Circle#render
5612+
* @param {object} context - The context to render to.
5613+
* @param {number} xOffset - X offset from circle's position to render at.
5614+
* @param {number} yOffset - Y offset from circle's position to render at.
5615+
* @param {string} color - color of the debug shape to be rendered. (format is css color string).
5616+
* @param {boolean} filled - Render the shape as solid (true) or hollow (false).
5617+
*/
5618+
render: function(context, xOffset, yOffset, color, filled) {
5619+
var x = this.pos.x - xOffset;
5620+
var y = this.pos.y - yOffset;
5621+
5622+
context.beginPath();
5623+
context.arc(x, y, this.radius, 0, 2 * Math.PI, false);
55615624

5625+
if (filled)
5626+
{
5627+
context.fillStyle = color;
5628+
context.fill();
5629+
}
5630+
else
5631+
{
5632+
context.strokeStyle = color;
5633+
context.stroke();
5634+
}
5635+
}
55625636
};

build/custom/ninja.min.js

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

0 commit comments

Comments
 (0)