4 Commits
25 changed files with 603 additions and 97 deletions
Submodule Docs/yuidoc-theme-dana added at f4dea8f2cc
+20 -1
View File
@@ -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)
@@ -20,6 +20,10 @@ Try out the [Phaser Test Suite](http://gametest.mobi/phaser/)
Latest Update
-------------
September 15th 2013
Version 1.0.1 and 1.0.2 have been tagged and released. See the Change Log for full details. As 1.0 is so fresh please expect small minor updates every few days, but we will be sure to tag them.
September 13th 2013
We're very pleased to have finally shipped the 1.0 release of Phaser. This version represents many months of hard work, feedback and refactoring based on the previous 0.5 through to 0.97 releases. You can see the full gory details in our change log.
@@ -34,6 +38,21 @@ Phaser is everything we ever wanted from an HTML5 game framework. It will power
![Blasteroids](http://www.photonstorm.com/wp-content/uploads/2013/04/phaser_blaster.png)
Change Log
----------
Version 1.0.2
* Added optional parameter to Animation.stop: resetFrame. If true the animation will be stopped and then the current frame reset to the first frame in the animation.
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.
Requirements
------------
+1 -1
View File
File diff suppressed because one or more lines are too long
+68 -46
View File
@@ -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
*
@@ -34,7 +34,7 @@ var PIXI = PIXI || {};
*/
var Phaser = Phaser || {
VERSION: '1.0.0',
VERSION: '1.0.1',
GAMES: [],
AUTO: 0,
CANVAS: 1,
@@ -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)
{
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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();
}
}
},
@@ -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);
@@ -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 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;
}
}
}
@@ -25605,13 +25625,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
@@ -25619,13 +25640,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;
}
}
}
@@ -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 });
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

File diff suppressed because one or more lines are too long
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="64" height="64" tilewidth="16" tileheight="16">
<tileset firstgid="1" name="tiles-1" tilewidth="16" tileheight="16">
<image source="tiles-1.png" width="272" height="64"/>
</tileset>
<layer name="Tile Layer 1" width="64" height="64">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,19,19,
6,2,3,6,7,0,0,0,0,0,0,13,14,0,0,0,0,0,0,13,14,0,0,0,0,1,34,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,19,19,19,19,
36,19,22,23,24,0,0,0,0,0,1,30,31,9,0,0,0,0,1,30,31,9,0,0,0,59,55,57,60,0,0,0,0,0,0,47,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,19,19,19,19,19,
19,19,39,40,41,0,0,0,0,0,25,19,19,26,0,0,0,0,25,19,19,26,0,0,0,0,0,0,0,0,0,0,0,0,1,64,65,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,
20,54,55,57,60,0,0,0,0,0,59,57,53,60,0,0,0,0,59,57,53,60,0,0,0,0,0,0,0,0,0,0,0,0,59,57,56,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,
24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,
43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
43,0,0,0,0,0,0,47,48,0,0,0,0,0,47,48,0,0,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,19,
19,9,0,0,0,1,4,64,65,2,3,4,5,2,64,65,3,6,7,0,1,2,2,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,0,19,
19,26,0,0,0,18,19,19,19,19,19,37,19,19,36,19,22,23,24,0,18,19,19,24,0,0,0,0,0,0,0,0,0,0,1,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,19,
19,43,0,0,0,25,19,19,19,19,36,19,19,19,19,19,39,40,41,0,18,19,19,19,9,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
19,41,0,0,0,42,19,19,19,53,54,53,53,55,53,54,55,57,60,0,59,56,56,56,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,
19,43,0,0,0,18,19,19,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,
19,26,0,0,0,35,19,19,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,66,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,
37,26,0,0,0,52,56,56,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,57,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
19,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,19,
19,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,13,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,9,0,0,0,1,19,19,19,0,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0,0,19,
19,26,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,2,30,30,31,2,6,7,0,0,13,0,0,0,0,0,0,0,0,59,57,60,0,0,0,42,19,19,19,0,0,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0,19,
19,43,0,0,0,0,0,0,0,0,0,0,0,1,20,21,22,23,19,19,19,19,19,19,19,6,3,30,4,7,0,0,0,0,0,0,0,0,0,0,0,44,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
19,41,0,49,50,51,0,47,48,0,0,0,1,36,37,38,39,40,19,19,19,19,19,19,19,19,19,19,19,26,0,0,0,0,0,0,0,0,0,44,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
19,19,3,66,67,68,2,64,65,6,2,3,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,57,57,58,0,0,0,0,0,0,44,19,19,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
19,19,20,19,19,19,19,19,37,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,41,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,0,0,19,0,0,0,0,0,19,
37,19,19,19,19,19,20,19,19,38,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,57,60,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,0,19,19,19,0,0,0,0,19,
19,19,20,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,41,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,19,
19,38,19,19,19,19,19,19,19,19,19,19,19,19,57,57,57,57,57,57,57,57,57,57,60,0,0,0,0,0,0,0,19,19,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
19,19,19,19,19,19,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,19,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
19,19,19,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,19,19,19,19,19,19,19,19,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,19,
19,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,0,0,19,19,0,0,0,0,0,19,
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,19,19,19,19,0,0,0,0,0,19,19,19,19,19,0,19,19,0,0,0,0,0,19,19,19,19,0,0,0,0,19,
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,19,19,
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,0,0,0,0,0,0,0,0,0,0,19,19,19,
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,19,19,19,19,19,
19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,19,19,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,19,
19,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,19,19,19,19,19,19,19,0,0,0,0,19,19,19,19,19,0,0,0,0,0,0,19,19,19,19,19,19,19,
19,19,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,19,19,19,19,19,19,19,
19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,
19,19,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,
19,19,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,
19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,19,19,0,0,19,19,19,19,19,19,19,19,19,
19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,19,19,19,0,19,19,19,19,19,19,19,19,19,19,
19,19,19,19,19,19,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19,0,0,0,0,0,0,0,19,19,19,19,19,19,0,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,
19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19
</data>
</layer>
</map>
Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

+125
View File
@@ -0,0 +1,125 @@
<?php
$title = "Star Struck";
require('../head.php');
?>
<script type="text/javascript">
(function () {
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
function preload() {
game.load.tilemap('level1', 'assets/games/starstruck/tiles-1.png', 'assets/games/starstruck/level1.json', null, Phaser.Tilemap.JSON);
game.load.spritesheet('dude', 'assets/games/starstruck/dude.png', 32, 48);
game.load.spritesheet('droid', 'assets/games/starstruck/droid.png', 32, 32);
game.load.image('starSmall', 'assets/games/starstruck/star.png');
game.load.image('starBig', 'assets/games/starstruck/star2.png');
game.load.image('background', 'assets/games/starstruck/background2.png');
}
var map;
var player;
var facing = 'left';
var jumpTimer = 0;
var bg;
function create() {
game.stage.backgroundColor = '#000000';
bg = game.add.tileSprite(0, 0, 800, 600, 'background');
bg.scrollFactor.setTo(0, 0);
map = game.add.tilemap(0, 0, 'level1');
map.setCollisionRange(1, 12, true, true, true, true);
map.setCollisionRange(18, 47, true, true, true, true);
map.setCollisionRange(53, 69, true, true, true, true);
player = game.add.sprite(32, 32, 'dude');
player.body.bounce.y = 0.2;
player.body.collideWorldBounds = true;
player.animations.add('left', [0, 1, 2, 3], 10, true);
player.animations.add('turn', [4], 20, true);
player.animations.add('right', [5, 6, 7, 8], 10, true);
game.camera.follow(player);
}
function update() {
game.physics.collide(player, map);
player.body.velocity.x = 0;
player.body.acceleration.y = 500;
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
player.body.velocity.x = -150;
if (facing != 'left')
{
player.animations.play('left');
facing = 'left';
}
}
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
player.body.velocity.x = 150;
if (facing != 'right')
{
player.animations.play('right');
facing = 'right';
}
}
else
{
if (facing != 'idle')
{
player.animations.stop();
if (facing == 'left')
{
player.frame = 0;
}
else
{
player.frame = 5;
}
facing = 'idle';
}
}
if (game.input.keyboard.isDown(Phaser.Keyboard.UP) || game.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR))
{
if (player.body.touching.down && game.time.now > jumpTimer)
{
player.body.velocity.y = -200;
jumpTimer = game.time.now + 500;
}
}
}
function render() {
// game.debug.renderSpriteCorners(p);
// game.debug.renderSpriteCollision(p, 32, 320);
// game.debug.renderText(player.body.velocity.y, 32, 32, 'rgb(255,255,255)');
// game.debug.renderText('left: ' + player.body.touching.left, 32, 32, 'rgb(255,255,255)');
// game.debug.renderText('right: ' + player.body.touching.right, 32, 64, 'rgb(255,255,255)');
}
})();
</script>
<?php
require('../foot.php');
?>
+72
View File
@@ -0,0 +1,72 @@
<?php
$title = "Click to Burst";
require('../head.php');
?>
<script type="text/javascript">
(function () {
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });
var p;
var p2;
function preload() {
// game.load.image('carrot', 'assets/sprites/carrot.png');
// game.load.image('star', 'assets/misc/star_particle.png');
game.load.image('diamond', 'assets/sprites/diamond.png');
// game.load.image('dude', 'assets/sprites/phaser-dude.png');
// game.load.image('coke', 'assets/sprites/cokecan.png');
// game.load.atlasJSONHash('pixies', 'assets/sprites/pixi_monsters.png', 'assets/sprites/pixi_monsters.json');
game.load.spritesheet('balls', 'assets/sprites/balls.png', 17, 17);
}
function create() {
game.stage.backgroundColor = 0x337799;
p = game.add.emitter(0, 0, 200);
p.makeParticles('diamond');
// Steady constant stream at 250ms delay and 10 seconds lifespan
// p.start(false, 10000, 250, 100);
// p.start(true, 10000);
// explode, lifespan, frequency, quantity
// p.minParticleSpeed.setTo(-100, -100);
// p.maxParticleSpeed.setTo(100, -200);
p.gravity = 10;
// game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);
game.input.onDown.add(particleBurst, this);
}
function particleBurst() {
p.x = game.input.x;
p.y = game.input.y;
p.start(true, 2000, 10, 10);
}
function update() {
// p.y = game.math.min(100, game.input.y);
}
function render() {
}
})();
</script>
<?php
require('../foot.php');
?>
+77
View File
@@ -0,0 +1,77 @@
<?php
$title = "Diamond Burst";
require('../head.php');
?>
<script type="text/javascript">
(function () {
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });
var p;
var p2;
function preload() {
// game.load.image('carrot', 'assets/sprites/carrot.png');
// game.load.image('star', 'assets/misc/star_particle.png');
game.load.image('diamond', 'assets/sprites/diamond.png');
// game.load.image('dude', 'assets/sprites/phaser-dude.png');
// game.load.image('coke', 'assets/sprites/cokecan.png');
// game.load.atlasJSONHash('pixies', 'assets/sprites/pixi_monsters.png', 'assets/sprites/pixi_monsters.json');
// game.load.spritesheet('balls', 'assets/sprites/balls.png', 17, 17);
}
function create() {
game.stage.backgroundColor = 0x337799;
p = game.add.emitter(game.world.centerX, 200, 200);
// p.width = 200;
// p.height = 200;
// keys, frames, quantity, collide
p.makeParticles('diamond');
// p.makeParticles(['diamond', 'carrot', 'star']);
// p.makeParticles('balls', [0,1,2,3,4,5]);
// p.makeParticles('pixies', [0,1,2,3]);
// p.minParticleScale = 0.1;
// p.maxParticleScale = 0.5;
// Steady constant stream at 250ms delay and 10 seconds lifespan
// p.start(false, 10000, 250, 100);
// p.start(true, 10000);
// explode, lifespan, frequency, quantity
// p.minParticleSpeed.setTo(-100, -100);
// p.maxParticleSpeed.setTo(100, -200);
// p.gravity = 10;
// p.start(false, 3000, 10);
p.start(false, 5000, 20);
// game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);
}
function update() {
// p.y = game.math.min(100, game.input.y);
}
function render() {
}
})();
</script>
<?php
require('../foot.php');
?>
+46
View File
@@ -0,0 +1,46 @@
<?php
$title = "Random Sprite";
require('../head.php');
?>
<script type="text/javascript">
(function () {
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });
var emitter;
function preload() {
game.load.image('carrot', 'assets/sprites/carrot.png');
game.load.image('star', 'assets/misc/star_particle.png');
game.load.image('diamond', 'assets/sprites/diamond.png');
}
function create() {
game.stage.backgroundColor = 0x337799;
emitter = game.add.emitter(game.world.centerX, 200, 200);
// Here we're passing an array of image keys. It will pick one at random when emitting a new particle.
emitter.makeParticles(['diamond', 'carrot', 'star']);
emitter.start(false, 5000, 20);
}
function update() {
}
function render() {
}
})();
</script>
<?php
require('../foot.php');
?>
+1 -1
View File
@@ -17,7 +17,7 @@
"2d"
],
"author": "Richard Davey",
"license": "BSD",
"license": "MIT",
"readmeFilename": "README.md",
"gitHead": "1217bf4722768514fe15ff904dab59f848d146f4",
"devDependencies": {
+1 -1
View File
@@ -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
View File
@@ -3,7 +3,7 @@
*/
var Phaser = Phaser || {
VERSION: '1.0.0',
VERSION: '1.0.1',
GAMES: [],
AUTO: 0,
CANVAS: 1,
+8 -1
View File
@@ -91,11 +91,18 @@ Phaser.Animation.prototype = {
/**
* Stop playing animation and set it finished.
*/
stop: function () {
stop: function (resetFrame) {
if (typeof resetFrame == 'undefined') { resetFrame = false; }
this.isPlaying = false;
this.isFinished = true;
if (resetFrame)
{
this.currentFrame = this._frameData.getFrame(this._frames[0]);
}
},
/**
+17 -5
View File
@@ -163,15 +163,27 @@ 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) {
stop: function (name, resetFrame) {
if (this._anims[name])
if (typeof resetFrame == 'undefined') { resetFrame = false; }
if (typeof name == 'string')
{
this.currentAnim = this._anims[name];
this.currentAnim.stop();
if (this._anims[name])
{
this.currentAnim = this._anims[name];
this.currentAnim.stop(resetFrame);
}
}
else
{
if (this.currentAnim)
{
this.currentAnim.stop(resetFrame);
}
}
},
+24 -11
View File
@@ -91,11 +91,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)
{
@@ -379,7 +382,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;
@@ -430,7 +433,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;
@@ -453,7 +456,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;
@@ -474,7 +477,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;
@@ -495,7 +498,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;
@@ -525,7 +528,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;
@@ -553,7 +556,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;
@@ -581,7 +584,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;
@@ -610,7 +613,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;
@@ -639,7 +642,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;
@@ -669,6 +672,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;
@@ -705,6 +713,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;
+27 -29
View File
@@ -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;
}
}
}
+1
View File
@@ -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 });