Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f069107e55 | ||
|
|
49a6ba2c02 | ||
|
|
1bf838a4c4 |
@@ -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.
|
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)
|
By Richard Davey, [Photon Storm](http://www.photonstorm.com)
|
||||||
|
|
||||||
@@ -113,6 +113,17 @@ 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
|
Known Issues
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Phaser - http://www.phaser.io
|
* 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
|
* @author Richard Davey http://www.photonstorm.com @photonstorm
|
||||||
*
|
*
|
||||||
@@ -34,7 +34,7 @@ var PIXI = PIXI || {};
|
|||||||
*/
|
*/
|
||||||
var Phaser = Phaser || {
|
var Phaser = Phaser || {
|
||||||
|
|
||||||
VERSION: '1.0.0',
|
VERSION: '1.0.1',
|
||||||
GAMES: [],
|
GAMES: [],
|
||||||
AUTO: 0,
|
AUTO: 0,
|
||||||
CANVAS: 1,
|
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);
|
var child = new Phaser.Sprite(this.game, x, y, key, frame);
|
||||||
|
|
||||||
child.group = this;
|
child.group = this;
|
||||||
|
child.exists = exists;
|
||||||
|
|
||||||
if (child.events)
|
if (child.events)
|
||||||
{
|
{
|
||||||
@@ -9213,7 +9216,7 @@ Phaser.Group.prototype = {
|
|||||||
checkVisible = checkVisible || false;
|
checkVisible = checkVisible || false;
|
||||||
operation = operation || 0;
|
operation = operation || 0;
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = 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);
|
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;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -9287,7 +9290,7 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
if (typeof checkExists == 'undefined') { checkExists = false; }
|
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;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -9308,7 +9311,7 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
forEachAlive: function (callback, callbackContext) {
|
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;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -9329,7 +9332,7 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
forEachDead: function (callback, callbackContext) {
|
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;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -9359,7 +9362,7 @@ Phaser.Group.prototype = {
|
|||||||
state = true;
|
state = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = this._container.first._iNext;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -9387,7 +9390,7 @@ Phaser.Group.prototype = {
|
|||||||
*/
|
*/
|
||||||
getFirstAlive: function () {
|
getFirstAlive: function () {
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = this._container.first._iNext;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -9415,7 +9418,7 @@ Phaser.Group.prototype = {
|
|||||||
*/
|
*/
|
||||||
getFirstDead: function () {
|
getFirstDead: function () {
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = this._container.first._iNext;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -9444,7 +9447,7 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
var total = -1;
|
var total = -1;
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = this._container.first._iNext;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -9473,7 +9476,7 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
var total = -1;
|
var total = -1;
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = this._container.first._iNext;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -9503,6 +9506,11 @@ Phaser.Group.prototype = {
|
|||||||
*/
|
*/
|
||||||
getRandom: function (startIndex, length) {
|
getRandom: function (startIndex, length) {
|
||||||
|
|
||||||
|
if (this._container.children.length == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
startIndex = startIndex || 0;
|
startIndex = startIndex || 0;
|
||||||
length = length || this._container.children.length;
|
length = length || this._container.children.length;
|
||||||
|
|
||||||
@@ -9539,6 +9547,11 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
removeBetween: function (startIndex, endIndex) {
|
removeBetween: function (startIndex, endIndex) {
|
||||||
|
|
||||||
|
if (this._container.children.length == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (startIndex > endIndex || startIndex < 0 || endIndex > this._container.children.length)
|
if (startIndex > endIndex || startIndex < 0 || endIndex > this._container.children.length)
|
||||||
{
|
{
|
||||||
return false;
|
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.
|
* Current animation will be automatically set to the stopped one.
|
||||||
*/
|
*/
|
||||||
stop: function (name) {
|
stop: function (name) {
|
||||||
|
|
||||||
if (this._anims[name])
|
if (typeof name == 'string')
|
||||||
{
|
{
|
||||||
this.currentAnim = this._anims[name];
|
if (this._anims[name])
|
||||||
this.currentAnim.stop();
|
{
|
||||||
|
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) {
|
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 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);
|
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
|
// 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
|
// 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 ...
|
// Going left ...
|
||||||
this._overlap = object.x - width - x;
|
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;
|
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 ...
|
// Going down ...
|
||||||
this._overlap = object.bottom - y;
|
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
|
else
|
||||||
{
|
{
|
||||||
this._overlap = 0;
|
object.touching.down = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -25619,13 +25640,13 @@ Phaser.Physics.Arcade.prototype = {
|
|||||||
// Going up ...
|
// Going up ...
|
||||||
this._overlap = object.y - height - y;
|
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
|
else
|
||||||
{
|
{
|
||||||
this._overlap = 0;
|
object.touching.up = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27658,6 +27679,7 @@ Phaser.TilemapLayer.prototype = {
|
|||||||
|
|
||||||
for (var r = 0; r < this._tempTileBlock.length; r++)
|
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))
|
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 });
|
this._tempBlockResults.push({ x: this._tempTileBlock[r].x, y: this._tempTileBlock[r].y, tile: this._tempTileBlock[r].tile });
|
||||||
|
|||||||
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
@@ -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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
19,19,0,0,0,19,19,19,19,2,3,4,5,2,6,2,3,6,7,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,
|
||||||
|
19,19,0,0,0,19,19,19,19,19,19,37,19,19,36,19,22,23,24,0,19,19,19,19,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,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
19,19,0,0,0,19,19,19,19,19,36,19,19,19,19,19,39,40,41,0,19,19,19,19,19,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,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
19,19,0,0,0,19,19,19,19,53,54,53,53,55,53,54,55,57,60,0,19,19,19,19,19,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,0,0,0,
|
||||||
|
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,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,0,0,0,
|
||||||
|
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,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,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
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,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,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,0,0,0,0,0,0,0,0,
|
||||||
|
19,19,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,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,
|
||||||
|
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,0,0,0,0,0,0,0,0,0,0,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,0,19,19,19,19,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,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,19,19,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,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,19,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,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,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,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,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,
|
||||||
|
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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
</map>
|
||||||
|
After Width: | Height: | Size: 286 B |
|
After Width: | Height: | Size: 443 B |
|
After Width: | Height: | Size: 2.9 KiB |
@@ -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, 20, 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');
|
||||||
|
?>
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
"2d"
|
"2d"
|
||||||
],
|
],
|
||||||
"author": "Richard Davey",
|
"author": "Richard Davey",
|
||||||
"license": "BSD",
|
"license": "MIT",
|
||||||
"readmeFilename": "README.md",
|
"readmeFilename": "README.md",
|
||||||
"gitHead": "1217bf4722768514fe15ff904dab59f848d146f4",
|
"gitHead": "1217bf4722768514fe15ff904dab59f848d146f4",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Phaser - http://www.phaser.io
|
* 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
|
* @author Richard Davey http://www.photonstorm.com @photonstorm
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
var Phaser = Phaser || {
|
var Phaser = Phaser || {
|
||||||
|
|
||||||
VERSION: '1.0.0',
|
VERSION: '1.0.1',
|
||||||
GAMES: [],
|
GAMES: [],
|
||||||
AUTO: 0,
|
AUTO: 0,
|
||||||
CANVAS: 1,
|
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.
|
* Current animation will be automatically set to the stopped one.
|
||||||
*/
|
*/
|
||||||
stop: function (name) {
|
stop: function (name) {
|
||||||
|
|
||||||
if (this._anims[name])
|
if (typeof name == 'string')
|
||||||
{
|
{
|
||||||
this.currentAnim = this._anims[name];
|
if (this._anims[name])
|
||||||
this.currentAnim.stop();
|
{
|
||||||
|
this.currentAnim = this._anims[name];
|
||||||
|
this.currentAnim.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.currentAnim)
|
||||||
|
{
|
||||||
|
this.currentAnim.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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);
|
var child = new Phaser.Sprite(this.game, x, y, key, frame);
|
||||||
|
|
||||||
child.group = this;
|
child.group = this;
|
||||||
|
child.exists = exists;
|
||||||
|
|
||||||
if (child.events)
|
if (child.events)
|
||||||
{
|
{
|
||||||
@@ -379,7 +382,7 @@ Phaser.Group.prototype = {
|
|||||||
checkVisible = checkVisible || false;
|
checkVisible = checkVisible || false;
|
||||||
operation = operation || 0;
|
operation = operation || 0;
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = 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);
|
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;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -453,7 +456,7 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
if (typeof checkExists == 'undefined') { checkExists = false; }
|
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;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -474,7 +477,7 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
forEachAlive: function (callback, callbackContext) {
|
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;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -495,7 +498,7 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
forEachDead: function (callback, callbackContext) {
|
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;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -525,7 +528,7 @@ Phaser.Group.prototype = {
|
|||||||
state = true;
|
state = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = this._container.first._iNext;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -553,7 +556,7 @@ Phaser.Group.prototype = {
|
|||||||
*/
|
*/
|
||||||
getFirstAlive: function () {
|
getFirstAlive: function () {
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = this._container.first._iNext;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -581,7 +584,7 @@ Phaser.Group.prototype = {
|
|||||||
*/
|
*/
|
||||||
getFirstDead: function () {
|
getFirstDead: function () {
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = this._container.first._iNext;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -610,7 +613,7 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
var total = -1;
|
var total = -1;
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = this._container.first._iNext;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -639,7 +642,7 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
var total = -1;
|
var total = -1;
|
||||||
|
|
||||||
if (this._container.first._iNext)
|
if (this._container.children.length > 0 && this._container.first._iNext)
|
||||||
{
|
{
|
||||||
var currentNode = this._container.first._iNext;
|
var currentNode = this._container.first._iNext;
|
||||||
|
|
||||||
@@ -669,6 +672,11 @@ Phaser.Group.prototype = {
|
|||||||
*/
|
*/
|
||||||
getRandom: function (startIndex, length) {
|
getRandom: function (startIndex, length) {
|
||||||
|
|
||||||
|
if (this._container.children.length == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
startIndex = startIndex || 0;
|
startIndex = startIndex || 0;
|
||||||
length = length || this._container.children.length;
|
length = length || this._container.children.length;
|
||||||
|
|
||||||
@@ -705,6 +713,11 @@ Phaser.Group.prototype = {
|
|||||||
|
|
||||||
removeBetween: function (startIndex, endIndex) {
|
removeBetween: function (startIndex, endIndex) {
|
||||||
|
|
||||||
|
if (this._container.children.length == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (startIndex > endIndex || startIndex < 0 || endIndex > this._container.children.length)
|
if (startIndex > endIndex || startIndex < 0 || endIndex > this._container.children.length)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -626,7 +626,6 @@ Phaser.Physics.Arcade.prototype = {
|
|||||||
*/
|
*/
|
||||||
separateTile: function (object, x, y, width, height, mass, collideLeft, collideRight, collideUp, collideDown, separateX, separateY) {
|
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 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);
|
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
|
// 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
|
// 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 ...
|
// Going left ...
|
||||||
this._overlap = object.x - width - x;
|
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;
|
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 ...
|
// Going down ...
|
||||||
this._overlap = object.bottom - y;
|
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
|
else
|
||||||
{
|
{
|
||||||
this._overlap = 0;
|
object.touching.down = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -779,13 +777,13 @@ Phaser.Physics.Arcade.prototype = {
|
|||||||
// Going up ...
|
// Going up ...
|
||||||
this._overlap = object.y - height - y;
|
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
|
else
|
||||||
{
|
{
|
||||||
this._overlap = 0;
|
object.touching.up = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -326,6 +326,7 @@ Phaser.TilemapLayer.prototype = {
|
|||||||
|
|
||||||
for (var r = 0; r < this._tempTileBlock.length; r++)
|
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))
|
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 });
|
this._tempBlockResults.push({ x: this._tempTileBlock[r].x, y: this._tempTileBlock[r].y, tile: this._tempTileBlock[r].tile });
|
||||||
|
|||||||