mirror of
https://github.com/wassname/phaser.git
synced 2026-08-05 13:21:00 +08:00
1.0.1 release - fixes issues in tile map collision, additional Animation stop checks and updated package license.
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Phaser - http://www.phaser.io
|
||||
*
|
||||
* v1.0.0 - Built at: {buildDate}
|
||||
* v1.0.1 - Built at: {buildDate}
|
||||
*
|
||||
* @author Richard Davey http://www.photonstorm.com @photonstorm
|
||||
*
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
var Phaser = Phaser || {
|
||||
|
||||
VERSION: '1.0.0',
|
||||
VERSION: '1.0.1',
|
||||
GAMES: [],
|
||||
AUTO: 0,
|
||||
CANVAS: 1,
|
||||
|
||||
@@ -163,15 +163,25 @@ Phaser.AnimationManager.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Stop animation by name.
|
||||
* Stop animation. If a name is given that specific animation is stopped, otherwise the current one is stopped.
|
||||
* Current animation will be automatically set to the stopped one.
|
||||
*/
|
||||
stop: function (name) {
|
||||
|
||||
if (this._anims[name])
|
||||
if (typeof name == 'string')
|
||||
{
|
||||
this.currentAnim = this._anims[name];
|
||||
this.currentAnim.stop();
|
||||
if (this._anims[name])
|
||||
{
|
||||
this.currentAnim = this._anims[name];
|
||||
this.currentAnim.stop();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.currentAnim)
|
||||
{
|
||||
this.currentAnim.stop();
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@@ -626,7 +626,6 @@ Phaser.Physics.Arcade.prototype = {
|
||||
*/
|
||||
separateTile: function (object, x, y, width, height, mass, collideLeft, collideRight, collideUp, collideDown, separateX, separateY) {
|
||||
|
||||
// Yes, the Y first
|
||||
var separatedY = this.separateTileY(object.body, x, y, width, height, mass, collideUp, collideDown, separateY);
|
||||
var separatedX = this.separateTileX(object.body, x, y, width, height, mass, collideLeft, collideRight, separateX);
|
||||
|
||||
@@ -671,34 +670,32 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// TODO - We need to check if we're already inside of the tile, i.e. jumping through an n-way tile
|
||||
// in which case we didn't ought to separate because it'll look like tunneling
|
||||
|
||||
if (object.deltaX() < 0)
|
||||
if (object.deltaX() > 0)
|
||||
{
|
||||
// Going right ...
|
||||
this._overlap = object.x + object.width - x;
|
||||
|
||||
if ((this._overlap > this._maxOverlap) || !object.allowCollision.right || !collideLeft)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
object.touching.right = true;
|
||||
}
|
||||
}
|
||||
else if (object.deltaX() < 0)
|
||||
{
|
||||
// Going left ...
|
||||
this._overlap = object.x - width - x;
|
||||
|
||||
if (object.allowCollision.left && collideLeft && this._overlap < this._maxOverlap)
|
||||
if ((-this._overlap > this._maxOverlap) || !object.allowCollision.left || !collideRight)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
object.touching.left = true;
|
||||
// console.log('left', this._overlap);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Going right ...
|
||||
this._overlap = object.right - x;
|
||||
|
||||
if (object.allowCollision.right && collideRight && this._overlap < this._maxOverlap)
|
||||
{
|
||||
object.touching.right = true;
|
||||
// console.log('right', this._overlap);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -765,13 +762,14 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Going down ...
|
||||
this._overlap = object.bottom - y;
|
||||
|
||||
if (object.allowCollision.down && collideDown && this._overlap < this._maxOverlap)
|
||||
// if (object.allowCollision.down && collideDown && this._overlap < this._maxOverlap)
|
||||
if ((this._overlap > this._maxOverlap) || !object.allowCollision.down || !collideDown)
|
||||
{
|
||||
object.touching.down = true;
|
||||
this._overlap = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._overlap = 0;
|
||||
object.touching.down = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -779,13 +777,13 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Going up ...
|
||||
this._overlap = object.y - height - y;
|
||||
|
||||
if (object.allowCollision.up && collideUp && this._overlap < this._maxOverlap)
|
||||
if ((-this._overlap > this._maxOverlap) || !object.allowCollision.up || !collideUp)
|
||||
{
|
||||
object.touching.up = true;
|
||||
this._overlap = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._overlap = 0;
|
||||
object.touching.up = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,6 +326,7 @@ Phaser.TilemapLayer.prototype = {
|
||||
|
||||
for (var r = 0; r < this._tempTileBlock.length; r++)
|
||||
{
|
||||
// separateTile: function (object, x, y, width, height, mass, collideLeft, collideRight, collideUp, collideDown, separateX, separateY)
|
||||
if (this.game.physics.separateTile(object, this._tempTileBlock[r].x * this.tileWidth, this._tempTileBlock[r].y * this.tileHeight, this.tileWidth, this.tileHeight, this._tempTileBlock[r].tile.mass, this._tempTileBlock[r].tile.collideLeft, this._tempTileBlock[r].tile.collideRight, this._tempTileBlock[r].tile.collideUp, this._tempTileBlock[r].tile.collideDown, this._tempTileBlock[r].tile.separateX, this._tempTileBlock[r].tile.separateY))
|
||||
{
|
||||
this._tempBlockResults.push({ x: this._tempTileBlock[r].x, y: this._tempTileBlock[r].y, tile: this._tempTileBlock[r].tile });
|
||||
|
||||
Reference in New Issue
Block a user