Skip to content

Commit f10f557

Browse files
committed
Merge branch 'master' of https://github.com/photonstorm/phaser
2 parents 7367852 + 0eafcc0 commit f10f557

5 files changed

Lines changed: 50 additions & 25 deletions

File tree

src/cameras/2d/BaseCamera.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,11 +727,12 @@ var BaseCamera = new Class({
727727
var ty = (objectX * mvb + objectY * mvd + mvf);
728728
var tw = ((objectX + objectW) * mva + (objectY + objectH) * mvc + mve);
729729
var th = ((objectX + objectW) * mvb + (objectY + objectH) * mvd + mvf);
730-
var cullW = cameraW + objectW;
731-
var cullH = cameraH + objectH;
730+
var cullTop = this.y;
731+
var cullBottom = cullTop + cameraH;
732+
var cullLeft = this.x;
733+
var cullRight = cullLeft + cameraW;
732734

733-
if (tx > -objectW && ty > -objectH && tx < cullW && ty < cullH &&
734-
tw > -objectW && th > -objectH && tw < cullW && th < cullH)
735+
if ((tw > cullLeft && tx < cullRight) && (th > cullTop && ty < cullBottom))
735736
{
736737
culledObjects.push(object);
737738
}

src/physics/arcade/PhysicsGroup.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ var PhysicsGroup = new Class({
121121
singleConfig.removeCallback = this.removeCallbackHandler;
122122
});
123123
}
124+
else
125+
{
126+
// config is not defined and children is not a plain object nor an array of plain objects
127+
config = {
128+
createCallback: this.createCallbackHandler,
129+
removeCallback: this.removeCallbackHandler
130+
}
131+
}
124132

125133
/**
126134
* The physics simulation.

src/textures/parsers/SpriteSheetFromAtlas.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,27 +117,33 @@ var SpriteSheetFromAtlas = function (texture, frame, config)
117117
{
118118
var destX = (leftRow) ? leftPad : 0;
119119
var destY = (topRow) ? topPad : 0;
120-
var destWidth = frameWidth;
121-
var destHeight = frameHeight;
120+
121+
var trimWidth = 0;
122+
var trimHeight = 0;
122123

123124
if (leftRow)
124125
{
125-
destWidth = leftWidth;
126+
trimWidth += (frameWidth - leftWidth);
126127
}
127-
else if (rightRow)
128+
129+
if (rightRow)
128130
{
129-
destWidth = rightWidth;
131+
trimWidth += (frameWidth - rightWidth);
130132
}
131133

132134
if (topRow)
133135
{
134-
destHeight = topHeight;
136+
trimHeight += (frameHeight - topHeight);
135137
}
136-
else if (bottomRow)
138+
139+
if (bottomRow)
137140
{
138-
destHeight = bottomHeight;
141+
trimHeight += (frameHeight - bottomHeight);
139142
}
140143

144+
var destWidth = frameWidth - trimWidth;
145+
var destHeight = frameHeight - trimHeight;
146+
141147
sheetFrame.cutWidth = destWidth;
142148
sheetFrame.cutHeight = destHeight;
143149

@@ -152,7 +158,7 @@ var SpriteSheetFromAtlas = function (texture, frame, config)
152158
}
153159
else if (rightRow)
154160
{
155-
frameX += rightRow;
161+
frameX += rightWidth;
156162
}
157163
else
158164
{

src/tilemaps/components/CullTiles.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
7171

7272
for (y = drawTop; y < drawBottom; y++)
7373
{
74-
for (x = drawLeft; x < drawRight; x++)
74+
for (x = drawLeft; mapData[y] && x < drawRight; x++)
7575
{
7676
tile = mapData[y][x];
77-
77+
7878
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
7979
{
8080
continue;
8181
}
82-
82+
8383
outputArray.push(tile);
8484
}
8585
}
@@ -90,15 +90,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
9090

9191
for (y = drawTop; y < drawBottom; y++)
9292
{
93-
for (x = drawRight; x >= drawLeft; x--)
93+
for (x = drawRight; mapData[y] && x >= drawLeft; x--)
9494
{
9595
tile = mapData[y][x];
96-
96+
9797
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
9898
{
9999
continue;
100100
}
101-
101+
102102
outputArray.push(tile);
103103
}
104104
}
@@ -109,15 +109,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
109109

110110
for (y = drawBottom; y >= drawTop; y--)
111111
{
112-
for (x = drawLeft; x < drawRight; x++)
112+
for (x = drawLeft; mapData[y] && x < drawRight; x++)
113113
{
114114
tile = mapData[y][x];
115-
115+
116116
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
117117
{
118118
continue;
119119
}
120-
120+
121121
outputArray.push(tile);
122122
}
123123
}
@@ -128,15 +128,15 @@ var CullTiles = function (layer, camera, outputArray, renderOrder)
128128

129129
for (y = drawBottom; y >= drawTop; y--)
130130
{
131-
for (x = drawRight; x >= drawLeft; x--)
131+
for (x = drawRight; mapData[y] && x >= drawLeft; x--)
132132
{
133133
tile = mapData[y][x];
134-
134+
135135
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
136136
{
137137
continue;
138138
}
139-
139+
140140
outputArray.push(tile);
141141
}
142142
}

src/tilemaps/parsers/tiled/ParseTilesets.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ var ParseTilesets = function (json)
7878
tiles[tile.id].objectgroup.objects = parsedObjects2;
7979
}
8080
}
81+
82+
// Copy animation data
83+
if(tile.animation) {
84+
if(tiles.hasOwnProperty(tile.id)){
85+
tiles[tile.id].animation = tile.animation;
86+
}
87+
else {
88+
tiles[tile.id] = { animation: tile.animation };
89+
}
90+
}
8191
}
8292

8393
newSet.tileData = tiles;

0 commit comments

Comments
 (0)