mirror of
https://github.com/wassname/phaser.git
synced 2026-07-19 11:26:26 +08:00
Tilemap.createCollisionObjects will parse Tiled data for objectgroups and convert polyline instances into physics objects you can collide with in the world.
After defining tiles that collide on a Tilemap, you need to call Tilemap.generateCollisionData(layer) to populate the physics world with the data required. Debug.renderPhysicsBody updated to take camera location and body rotation into account. Body movement functions put back to velocity :) Updated to latest dev version of pixi and latest p2.js Updated docs
This commit is contained in:
+83
-27
@@ -58,6 +58,10 @@
|
||||
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||
</li>
|
||||
@@ -90,10 +94,6 @@
|
||||
<a href="Phaser.Device.html">Device</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.DOMSprite.html">DOMSprite</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Easing.html">Easing</a>
|
||||
</li>
|
||||
@@ -142,6 +142,10 @@
|
||||
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Events.html">Events</a>
|
||||
</li>
|
||||
@@ -250,10 +254,6 @@
|
||||
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Physics.Arcade.Body.html">Body</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Plugin.html">Plugin</a>
|
||||
</li>
|
||||
@@ -314,6 +314,10 @@
|
||||
<a href="Phaser.Sprite.html">Sprite</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Stage.html">Stage</a>
|
||||
</li>
|
||||
@@ -412,6 +416,10 @@
|
||||
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#getBounds">getBounds</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||
</li>
|
||||
@@ -522,11 +530,14 @@ Phaser.Circle.prototype = {
|
||||
* @return {Circle} This circle object.
|
||||
*/
|
||||
setTo: function (x, y, diameter) {
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this._diameter = diameter;
|
||||
this._radius = diameter * 0.5;
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -536,7 +547,9 @@ Phaser.Circle.prototype = {
|
||||
* @return {Circle} This Circle object.
|
||||
*/
|
||||
copyFrom: function (source) {
|
||||
|
||||
return this.setTo(source.x, source.y, source.diameter);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -545,11 +558,14 @@ Phaser.Circle.prototype = {
|
||||
* @param {any} dest - The object to copy to.
|
||||
* @return {Object} This dest object.
|
||||
*/
|
||||
copyTo: function(dest) {
|
||||
copyTo: function (dest) {
|
||||
|
||||
dest.x = this.x;
|
||||
dest.y = this.y;
|
||||
dest.diameter = this._diameter;
|
||||
|
||||
return dest;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -581,7 +597,7 @@ Phaser.Circle.prototype = {
|
||||
* @param {Phaser.Circle} out - Optional Circle object. If given the values will be set into the object, otherwise a brand new Circle object will be created and returned.
|
||||
* @return {Phaser.Circle} The cloned Circle object.
|
||||
*/
|
||||
clone: function(out) {
|
||||
clone: function (out) {
|
||||
|
||||
if (typeof out === "undefined")
|
||||
{
|
||||
@@ -604,7 +620,9 @@ Phaser.Circle.prototype = {
|
||||
* @return {boolean} True if the coordinates are within this circle, otherwise false.
|
||||
*/
|
||||
contains: function (x, y) {
|
||||
|
||||
return Phaser.Circle.contains(this, x, y);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -616,7 +634,9 @@ Phaser.Circle.prototype = {
|
||||
* @return {Phaser.Point} The Point object holding the result.
|
||||
*/
|
||||
circumferencePoint: function (angle, asDegrees, out) {
|
||||
|
||||
return Phaser.Circle.circumferencePoint(this, angle, asDegrees, out);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -627,9 +647,12 @@ Phaser.Circle.prototype = {
|
||||
* @return {Circle} This Circle object.
|
||||
*/
|
||||
offset: function (dx, dy) {
|
||||
|
||||
this.x += dx;
|
||||
this.y += dy;
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -667,7 +690,9 @@ Object.defineProperty(Phaser.Circle.prototype, "diameter", {
|
||||
},
|
||||
|
||||
set: function (value) {
|
||||
if (value > 0) {
|
||||
|
||||
if (value > 0)
|
||||
{
|
||||
this._diameter = value;
|
||||
this._radius = value * 0.5;
|
||||
}
|
||||
@@ -687,10 +712,13 @@ Object.defineProperty(Phaser.Circle.prototype, "radius", {
|
||||
},
|
||||
|
||||
set: function (value) {
|
||||
if (value > 0) {
|
||||
|
||||
if (value > 0)
|
||||
{
|
||||
this._radius = value;
|
||||
this._diameter = value * 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -707,12 +735,17 @@ Object.defineProperty(Phaser.Circle.prototype, "left", {
|
||||
},
|
||||
|
||||
set: function (value) {
|
||||
if (value > this.x) {
|
||||
|
||||
if (value > this.x)
|
||||
{
|
||||
this._radius = 0;
|
||||
this._diameter = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
this.radius = this.x - value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -729,12 +762,17 @@ Object.defineProperty(Phaser.Circle.prototype, "right", {
|
||||
},
|
||||
|
||||
set: function (value) {
|
||||
if (value < this.x) {
|
||||
|
||||
if (value < this.x)
|
||||
{
|
||||
this._radius = 0;
|
||||
this._diameter = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
this.radius = value - this.x;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -751,12 +789,17 @@ Object.defineProperty(Phaser.Circle.prototype, "top", {
|
||||
},
|
||||
|
||||
set: function (value) {
|
||||
if (value > this.y) {
|
||||
|
||||
if (value > this.y)
|
||||
{
|
||||
this._radius = 0;
|
||||
this._diameter = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
this.radius = this.y - value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -774,12 +817,16 @@ Object.defineProperty(Phaser.Circle.prototype, "bottom", {
|
||||
|
||||
set: function (value) {
|
||||
|
||||
if (value < this.y) {
|
||||
if (value < this.y)
|
||||
{
|
||||
this._radius = 0;
|
||||
this._diameter = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
this.radius = value - this.y;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -793,11 +840,16 @@ Object.defineProperty(Phaser.Circle.prototype, "bottom", {
|
||||
Object.defineProperty(Phaser.Circle.prototype, "area", {
|
||||
|
||||
get: function () {
|
||||
if (this._radius > 0) {
|
||||
|
||||
if (this._radius > 0)
|
||||
{
|
||||
return Math.PI * this._radius * this._radius;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -887,7 +939,8 @@ Phaser.Circle.circumferencePoint = function (a, angle, asDegrees, out) {
|
||||
if (typeof asDegrees === "undefined") { asDegrees = false; }
|
||||
if (typeof out === "undefined") { out = new Phaser.Point(); }
|
||||
|
||||
if (asDegrees === true) {
|
||||
if (asDegrees === true)
|
||||
{
|
||||
angle = Phaser.Math.radToDeg(angle);
|
||||
}
|
||||
|
||||
@@ -910,18 +963,21 @@ Phaser.Circle.intersectsRectangle = function (c, r) {
|
||||
var cx = Math.abs(c.x - r.x - r.halfWidth);
|
||||
var xDist = r.halfWidth + c.radius;
|
||||
|
||||
if (cx > xDist) {
|
||||
if (cx > xDist)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var cy = Math.abs(c.y - r.y - r.halfHeight);
|
||||
var yDist = r.halfHeight + c.radius;
|
||||
|
||||
if (cy > yDist) {
|
||||
if (cy > yDist)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cx <= r.halfWidth || cy <= r.halfHeight) {
|
||||
if (cx <= r.halfWidth || cy <= r.halfHeight)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -958,7 +1014,7 @@ PIXI.Circle = Phaser.Circle;
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user