Skip to content

Commit 2520323

Browse files
committed
Merge branch 'dev' of github.com:jotson/phaser into dev
2 parents 27bdbba + eeff786 commit 2520323

18 files changed

Lines changed: 228 additions & 253 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
There is an extensive [Migration Guide](https://github.com/photonstorm/phaser/blob/master/resources/Migration%20Guide.md) available for those converting from Phaser 1.x to 2.x. In the guide we detail the API breaking changes and approach to our new physics system.
44

5+
## Version 2.0.4 - "Mos Shirare" - in development
6+
7+
8+
59
## Version 2.0.3 - "Allorallen" - 11th April 2014
610

711
### Updates

README.md

Lines changed: 26 additions & 154 deletions
Large diffs are not rendered by default.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "phaser",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"homepage": "http://phaser.io",
55
"authors": [
66
"photonstorm <rich@photonstorm.com>"

build/phaser.d.ts

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ declare module PIXI {
469469
drawRect(x: number, y: number, width: number, height: number): void;
470470
endFill(): void;
471471
generateTexture(): Texture;
472+
generateTexture(renderer: PIXI.IPixiRenderer): RenderTexture;
472473
getBounds(): Rectangle;
473474
lineStyle(lineWidth: number, color: number, alpha: number): void;
474475
lineTo(x: number, y: number): void;
@@ -1957,7 +1958,8 @@ declare module Phaser {
19571958
countLiving(): number;
19581959
create(x: number, y: number, key: string, frame?: any, exists?: boolean): Phaser.Sprite;
19591960
createMultiple(quantity: number, key: string, frame?: any, exists?: boolean): Phaser.Sprite;
1960-
destroy(destroyChildren?: boolean, soft?:boolean): void;
1961+
customSort(sortHandler: Function, context: Object): void;
1962+
destroy(destroyChildren?: boolean, soft?: boolean): void;
19611963
divideAll(property: string, amount: number, checkAlive?: boolean, checkVisible?: boolean): void;
19621964
forEach(callback: Function, callbackContext: Object, checkExists?: boolean): void;
19631965
forEachAlive(callback: Function, callbackContext: Object): void;
@@ -1979,9 +1981,9 @@ declare module Phaser {
19791981
postUpdate(): void;
19801982
preUpdate(): void;
19811983
previous(): void;
1982-
remove(child: any): boolean;
1983-
removeAll(): void;
1984-
removeBetween(startIndex: number, endIndex: number): void;
1984+
remove(child: any, destroy?: boolean): boolean;
1985+
removeAll(destroy?: boolean): void;
1986+
removeBetween(startIndex: number, endIndex?: number, destroy?: boolean): void;
19851987
replace(oldChild: any, newChild: any): any;
19861988
reverse(): void;
19871989
sendToBack(child: any): any;
@@ -2411,6 +2413,7 @@ declare module Phaser {
24112413
game: Phaser.Game;
24122414
hasLoaded: boolean;
24132415
isLoading: boolean;
2416+
onFileStart: Phaser.Signal;
24142417
onFileComplete: Phaser.Signal;
24152418
onFileError: Phaser.Signal;
24162419
onLoadComplete: Phaser.Signal;
@@ -2598,6 +2601,18 @@ declare module Phaser {
25982601

25992602
}
26002603

2604+
class Particle extends Phaser.Sprite {
2605+
2606+
constructor(game: Phaser.Game, x: number, y: number, key?: any, frame?: any);
2607+
2608+
onEmit(): void;
2609+
reset(x: number, y: number, health?: number): Phaser.Particle;
2610+
setAlphaData(data: any[]): void;
2611+
setScaleData(data: any[]): void;
2612+
update(): void;
2613+
2614+
}
2615+
26012616
class Particles {
26022617

26032618
constructor(game: Phaser.Game);
@@ -2619,7 +2634,10 @@ declare module Phaser {
26192634
class Emitter extends Phaser.Group {
26202635

26212636
constructor(game: Phaser.Game, x?: number, y?: number, maxParticles?: number);
2622-
2637+
2638+
alphaData: any[];
2639+
autoAlpha: boolean;
2640+
autoScale: boolean;
26232641
angle: number;
26242642
angularDrag: number;
26252643
bottom: number;
@@ -2633,7 +2651,7 @@ declare module Phaser {
26332651
height: number;
26342652
left: number;
26352653
lifespan: number;
2636-
maxParticles: number;//
2654+
maxParticles: number;
26372655
maxParticleScale: number;
26382656
maxParticleSpeed: Phaser.Point;
26392657
maxRotation: number;
@@ -2642,10 +2660,13 @@ declare module Phaser {
26422660
minRotation: number;
26432661
name: string;
26442662
on: boolean;
2663+
particleBringToTop: boolean;
2664+
particleSendToBack: boolean;
26452665
particleClass: Phaser.Sprite;
26462666
particleDrag: Phaser.Point;
26472667
position: Phaser.Point;
26482668
right: number;
2669+
scaleData: any[];
26492670
top: number;
26502671
type: number;
26512672
width: number;
@@ -2656,7 +2677,10 @@ declare module Phaser {
26562677
emitParticle(): void;
26572678
kill(): void;
26582679
makeParticles(keys: any, frames: any, quantity: number, collide?: boolean, collideWorldBounds?: boolean): Phaser.Particles.Arcade.Emitter;
2680+
reset(x: number, y: number, health?: number): Phaser.Particles;
2681+
setAlpha(min?: number, max?: number, rate?: number, ease?: number, yoyo?: boolean): void;
26592682
setRotation(min?: number, max?: number): void;
2683+
setScale(min?: number, max?: number, rate?: number, ease?: number, yoyo?: boolean): void;
26602684
setSize(width: number, height: number): void;
26612685
setXSpeed(min: number, max: number): void;
26622686
setYSpeed(min: number, max: number): void;
@@ -3019,8 +3043,11 @@ declare module Phaser {
30193043
applyGravity: boolean;
30203044
applySpringForced: boolean;
30213045
bounds: Phaser.Physics.P2.Body;
3046+
boundsCollidesWith: Phaser.Physics.P2.Body[];
3047+
contactMaterial: Phaser.Physics.P2.ContactMaterial;
30223048
emitImpactEvent: boolean;
30233049
enableBodySleeping: boolean;
3050+
everythingCollisionGroup: Phaser.Physics.P2.CollisionGroup;
30243051
frameRate: number;
30253052
friction: number;
30263053
game: Phaser.Game;
@@ -3230,6 +3257,23 @@ declare module Phaser {
32303257

32313258
}
32323259

3260+
class FixtureList {
3261+
3262+
constructor(list: any[]);
3263+
3264+
flatten(array: any[]): any[];
3265+
getFixtures(keys: string): any[];
3266+
getFixtureByKey(key: string): any[];
3267+
getGroup(groupID: number): any[];
3268+
init(): void;
3269+
parse(): void;
3270+
setCategory(bit: number, fictureKey: string): void;
3271+
setMask(bit: number, fixtureKey: string): void;
3272+
setMaterial(material: Object, fixtureKey: string): void;
3273+
setSensor(value: boolean, fixtureKey: string): void;
3274+
3275+
}
3276+
32333277
class GearConstraint {
32343278

32353279
constructor(world: Phaser.Physics.P2, bodyA: Phaser.Physics.P2.Body, bodyB: Phaser.Physics.P2.Body, angle?: number, ratio?: number);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Phaser",
3-
"version": "2.0.3",
4-
"release": "Allorallen",
3+
"version": "2.0.4",
4+
"release": "Mos Shirare",
55
"description": "A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.",
66
"author": "Richard Davey",
77
"logo": "https://raw.github.com/photonstorm/phaser/master/phaser-logo-small.png",

src/Phaser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
var Phaser = Phaser || {
1212

1313
VERSION: '<%= version %>',
14-
DEV_VERSION: '2.0.3',
14+
DEV_VERSION: '2.0.4',
1515
GAMES: [],
1616

1717
AUTO: 0,

src/animation/Animation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,9 @@ Phaser.Animation.prototype = {
386386
this.currentFrame = null;
387387
this.isPlaying = false;
388388

389-
this.onStart.destroy();
390-
this.onLoop.destroy();
391-
this.onComplete.destroy();
389+
this.onStart.dispose();
390+
this.onLoop.dispose();
391+
this.onComplete.dispose();
392392

393393
this.game.onPause.remove(this.onPause, this);
394394
this.game.onResume.remove(this.onResume, this);

src/animation/AnimationManager.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Phaser.AnimationManager.prototype = {
195195

196196
if (this._anims[name])
197197
{
198-
if (this.currentAnim == this._anims[name])
198+
if (this.currentAnim === this._anims[name])
199199
{
200200
if (this.currentAnim.isPlaying === false)
201201
{
@@ -205,6 +205,11 @@ Phaser.AnimationManager.prototype = {
205205
}
206206
else
207207
{
208+
if (this.currentAnim && this.currentAnim.isPlaying)
209+
{
210+
this.currentAnim.stop();
211+
}
212+
208213
this.currentAnim = this._anims[name];
209214
this.currentAnim.paused = false;
210215
return this.currentAnim.play(frameRate, loop, killOnComplete);
@@ -306,12 +311,23 @@ Phaser.AnimationManager.prototype = {
306311
},
307312

308313
/**
309-
* Destroys all references this AnimationManager contains. Sets the _anims to a new object and nulls the current animation.
314+
* Destroys all references this AnimationManager contains.
315+
* Iterates through the list of animations stored in this manager and calls destroy on each of them.
310316
*
311317
* @method Phaser.AnimationManager#destroy
312318
*/
313319
destroy: function () {
314320

321+
var anim = null;
322+
323+
for (var anim in this._anims)
324+
{
325+
if (this._anims.hasOwnProperty(anim))
326+
{
327+
this._anims[anim].destroy();
328+
}
329+
}
330+
315331
this._anims = {};
316332
this._frameData = null;
317333
this._frameIndex = 0;

src/core/Group.js

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ Phaser.Group.prototype.remove = function (child, destroy) {
14111411
child.events.onRemovedFromGroup.dispatch(child, this);
14121412
}
14131413

1414-
this.removeChild(child);
1414+
var removed = this.removeChild(child);
14151415

14161416
this.updateZ();
14171417

@@ -1420,9 +1420,9 @@ Phaser.Group.prototype.remove = function (child, destroy) {
14201420
this.next();
14211421
}
14221422

1423-
if (destroy)
1423+
if (destroy && removed)
14241424
{
1425-
child.destroy();
1425+
removed.destroy();
14261426
}
14271427

14281428
return true;
@@ -1452,11 +1452,11 @@ Phaser.Group.prototype.removeAll = function (destroy) {
14521452
this.children[0].events.onRemovedFromGroup.dispatch(this.children[0], this);
14531453
}
14541454

1455-
this.removeChild(this.children[0]);
1455+
var removed = this.removeChild(this.children[0]);
14561456

1457-
if (destroy)
1457+
if (destroy && removed)
14581458
{
1459-
this.children[0].destroy();
1459+
removed.destroy();
14601460
}
14611461
}
14621462
while (this.children.length > 0);
@@ -1497,11 +1497,11 @@ Phaser.Group.prototype.removeBetween = function (startIndex, endIndex, destroy)
14971497
this.children[i].events.onRemovedFromGroup.dispatch(this.children[i], this);
14981498
}
14991499

1500-
this.removeChild(this.children[i]);
1500+
var removed = this.removeChild(this.children[i]);
15011501

1502-
if (destroy)
1502+
if (destroy && removed)
15031503
{
1504-
this.children[i].destroy();
1504+
removed.destroy();
15051505
}
15061506

15071507
if (this.cursor === this.children[i])
@@ -1530,24 +1530,7 @@ Phaser.Group.prototype.destroy = function (destroyChildren, soft) {
15301530
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
15311531
if (typeof soft === 'undefined') { soft = false; }
15321532

1533-
if (destroyChildren)
1534-
{
1535-
if (this.children.length > 0)
1536-
{
1537-
do
1538-
{
1539-
if (this.children[0].parent)
1540-
{
1541-
this.children[0].destroy(destroyChildren);
1542-
}
1543-
}
1544-
while (this.children.length > 0);
1545-
}
1546-
}
1547-
else
1548-
{
1549-
this.removeAll();
1550-
}
1533+
this.removeAll(destroyChildren);
15511534

15521535
this.cursor = null;
15531536

src/core/StateManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ Phaser.StateManager.prototype = {
275275
this._clearWorld = clearWorld;
276276
this._clearCache = clearCache;
277277

278-
if (arguments.length > 3)
278+
if (arguments.length > 2)
279279
{
280-
this._args = Array.prototype.splice.call(arguments, 3);
280+
this._args = Array.prototype.splice.call(arguments, 2);
281281
}
282282

283283
},

0 commit comments

Comments
 (0)