Skip to content

Commit

Permalink
1.0.1 release - fixes issues in tile map collision, additional Animat…
Browse files Browse the repository at this point in the history
…ion stop checks and updated package license.
  • Loading branch information
photonstorm committed Sep 15, 2013
1 parent 49a6ba2 commit f069107
Show file tree
Hide file tree
Showing 19 changed files with 342 additions and 68 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Phaser 1.0

Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It supports Canvas and WebGL rendering.

Version: 1.0.0 - Released: September 13th 2013
Version: 1.0.1 - Released: September 15th 2013

By Richard Davey, [Photon Storm](http://www.photonstorm.com)

Expand Down Expand Up @@ -116,8 +116,13 @@ Although Phaser 1.0 is a brand new release it is born from years of experience b
Change Log
----------

Version 1.0.1

* Added checks into every Group function to ensure that the Group has children before running them.
* Added optional flag to Group.create which allows you to set the default exists state of the Sprites.
* Sprite.animation.stop no longer needs an animation name parameter, will default to stopping the current animation.
* Fixed the license in package.json
* Fixed a logic bug in the separateTileX function that would sometimes cause tunneling of big sprites through small tiles.

Known Issues
------------
Expand Down
2 changes: 1 addition & 1 deletion build/phaser-min.js

Large diffs are not rendered by default.

98 changes: 60 additions & 38 deletions build/phaser.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Phaser - http://www.phaser.io
*
* v1.0.0 - Built at: Fri, 13 Sep 2013 16:50:35 +0000
* v1.0.1 - Built at: Sun, 15 Sep 2013 02:56:00 +0000
*
* @author Richard Davey http://www.photonstorm.com @photonstorm
*
Expand Down Expand Up @@ -34,7 +34,7 @@ var PIXI = PIXI || {};
*/
var Phaser = Phaser || {

VERSION: '1.0.0',
VERSION: '1.0.1',
GAMES: [],
AUTO: 0,
CANVAS: 1,
Expand Down Expand Up @@ -8925,11 +8925,14 @@ Phaser.Group.prototype = {

},

create: function (x, y, key, frame) {
create: function (x, y, key, frame, exists) {

if (typeof exists == 'undefined') { exists = true; }

var child = new Phaser.Sprite(this.game, x, y, key, frame);

child.group = this;
child.exists = exists;

if (child.events)
{
Expand Down Expand Up @@ -9213,7 +9216,7 @@ Phaser.Group.prototype = {
checkVisible = checkVisible || false;
operation = operation || 0;

if (this._container.first._iNext)
if (this._container.children.length > 0 && this._container.first._iNext)
{
var currentNode = this._container.first._iNext;

Expand Down Expand Up @@ -9264,7 +9267,7 @@ Phaser.Group.prototype = {

var args = Array.prototype.splice.call(arguments, 2);

if (this._container.first._iNext)
if (this._container.children.length > 0 && this._container.first._iNext)
{
var currentNode = this._container.first._iNext;

Expand All @@ -9287,7 +9290,7 @@ Phaser.Group.prototype = {

if (typeof checkExists == 'undefined') { checkExists = false; }

if (this._container.first._iNext)
if (this._container.children.length > 0 && this._container.first._iNext)
{
var currentNode = this._container.first._iNext;

Expand All @@ -9308,7 +9311,7 @@ Phaser.Group.prototype = {

forEachAlive: function (callback, callbackContext) {

if (this._container.first._iNext)
if (this._container.children.length > 0 && this._container.first._iNext)
{
var currentNode = this._container.first._iNext;

Expand All @@ -9329,7 +9332,7 @@ Phaser.Group.prototype = {

forEachDead: function (callback, callbackContext) {

if (this._container.first._iNext)
if (this._container.children.length > 0 && this._container.first._iNext)
{
var currentNode = this._container.first._iNext;

Expand Down Expand Up @@ -9359,7 +9362,7 @@ Phaser.Group.prototype = {
state = true;
}

if (this._container.first._iNext)
if (this._container.children.length > 0 && this._container.first._iNext)
{
var currentNode = this._container.first._iNext;

Expand Down Expand Up @@ -9387,7 +9390,7 @@ Phaser.Group.prototype = {
*/
getFirstAlive: function () {

if (this._container.first._iNext)
if (this._container.children.length > 0 && this._container.first._iNext)
{
var currentNode = this._container.first._iNext;

Expand Down Expand Up @@ -9415,7 +9418,7 @@ Phaser.Group.prototype = {
*/
getFirstDead: function () {

if (this._container.first._iNext)
if (this._container.children.length > 0 && this._container.first._iNext)
{
var currentNode = this._container.first._iNext;

Expand Down Expand Up @@ -9444,7 +9447,7 @@ Phaser.Group.prototype = {

var total = -1;

if (this._container.first._iNext)
if (this._container.children.length > 0 && this._container.first._iNext)
{
var currentNode = this._container.first._iNext;

Expand Down Expand Up @@ -9473,7 +9476,7 @@ Phaser.Group.prototype = {

var total = -1;

if (this._container.first._iNext)
if (this._container.children.length > 0 && this._container.first._iNext)
{
var currentNode = this._container.first._iNext;

Expand Down Expand Up @@ -9503,6 +9506,11 @@ Phaser.Group.prototype = {
*/
getRandom: function (startIndex, length) {

if (this._container.children.length == 0)
{
return null;
}

startIndex = startIndex || 0;
length = length || this._container.children.length;

Expand Down Expand Up @@ -9539,6 +9547,11 @@ Phaser.Group.prototype = {

removeBetween: function (startIndex, endIndex) {

if (this._container.children.length == 0)
{
return;
}

if (startIndex > endIndex || startIndex < 0 || endIndex > this._container.children.length)
{
return false;
Expand Down Expand Up @@ -20558,15 +20571,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();
}
}

},
Expand Down Expand Up @@ -25466,7 +25489,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);

Expand Down Expand Up @@ -25511,34 +25533,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 left ...
this._overlap = object.x - width - x;
// Going right ...
this._overlap = object.x + object.width - x;

if (object.allowCollision.left && collideLeft && this._overlap < this._maxOverlap)
if ((this._overlap > this._maxOverlap) || !object.allowCollision.right || !collideLeft)
{
object.touching.left = true;
// console.log('left', this._overlap);
this._overlap = 0;
}
else
{
this._overlap = 0;
object.touching.right = true;
}
}
else
else if (object.deltaX() < 0)
{
// Going right ...
this._overlap = object.right - x;
// Going left ...
this._overlap = object.x - width - x;

if (object.allowCollision.right && collideRight && this._overlap < this._maxOverlap)
if ((-this._overlap > this._maxOverlap) || !object.allowCollision.left || !collideRight)
{
object.touching.right = true;
// console.log('right', this._overlap);
this._overlap = 0;
}
else
{
this._overlap = 0;
object.touching.left = true;
}
}
}
Expand Down Expand Up @@ -25605,27 +25625,28 @@ 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
{
// 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;
}
}
}
Expand Down Expand Up @@ -27658,6 +27679,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 });
Expand Down
Binary file added examples/assets/games/starstruck/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/assets/games/starstruck/background2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/assets/games/starstruck/droid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/assets/games/starstruck/dude.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f069107

Please sign in to comment.