Skip to content

Commit cb9cb6e

Browse files
committed
Github Bug Fixes
1 parent e948f1e commit cb9cb6e

13 files changed

Lines changed: 99 additions & 31 deletions

File tree

Docs/phaser_tilemap_collision.png

120 KB
Loading

Phaser/Game.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ module Phaser {
8080
public onRenderCallback = null;
8181
public onPausedCallback = null;
8282

83-
public camera: Camera; // quick reference to the default created camera, access the rest via .world
8483
public cache: Cache;
8584
public collision: Collision;
8685
public input: Input;
@@ -330,7 +329,6 @@ module Phaser {
330329
this.onUpdateCallback = null;
331330
this.onRenderCallback = null;
332331
this.onPausedCallback = null;
333-
this.camera = null;
334332
this.cache = null;
335333
this.input = null;
336334
this.loader = null;
@@ -422,6 +420,10 @@ module Phaser {
422420
return this.collision.overlap(objectOrGroup1, objectOrGroup2, notifyCallback, Collision.separate);
423421
}
424422

423+
public get camera(): Camera {
424+
return this.world.cameras.current;
425+
}
426+
425427
}
426428

427429
}

Phaser/World.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ module Phaser {
1616

1717
this._game = game;
1818

19-
this._cameras = new CameraManager(this._game, 0, 0, width, height);
19+
this.cameras = new CameraManager(this._game, 0, 0, width, height);
2020

21-
this._game.camera = this._cameras.current;
21+
this._game.camera = this.cameras.current;
2222

2323
this.group = new Group(this._game, 0);
2424

@@ -29,8 +29,8 @@ module Phaser {
2929
}
3030

3131
private _game: Game;
32-
private _cameras: CameraManager;
3332

33+
public cameras: CameraManager;
3434
public group: Group;
3535
public bounds: Rectangle;
3636
public worldDivisions: number;
@@ -41,22 +41,22 @@ module Phaser {
4141
this.group.update();
4242
this.group.postUpdate();
4343

44-
this._cameras.update();
44+
this.cameras.update();
4545

4646
}
4747

4848
public render() {
4949

5050
// Unlike in flixel our render process is camera driven, not group driven
51-
this._cameras.render();
51+
this.cameras.render();
5252

5353
}
5454

5555
public destroy() {
5656

5757
this.group.destroy();
5858

59-
this._cameras.destroy();
59+
this.cameras.destroy();
6060

6161
}
6262

@@ -109,15 +109,15 @@ module Phaser {
109109
// Cameras
110110

111111
public createCamera(x: number, y: number, width: number, height: number): Camera {
112-
return this._cameras.addCamera(x, y, width, height);
112+
return this.cameras.addCamera(x, y, width, height);
113113
}
114114

115115
public removeCamera(id: number): bool {
116-
return this._cameras.removeCamera(id);
116+
return this.cameras.removeCamera(id);
117117
}
118118

119119
public getAllCameras(): Camera[] {
120-
return this._cameras.getAll();
120+
return this.cameras.getAll();
121121
}
122122

123123
// Game Objects

Phaser/gameobjects/Emitter.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ module Phaser {
2727
this.y = Y;
2828
this.width = 0;
2929
this.height = 0;
30-
this.minParticleSpeed = new Point(-100, -100);
31-
this.maxParticleSpeed = new Point(100, 100);
30+
this.minParticleSpeed = new MicroPoint(-100, -100);
31+
this.maxParticleSpeed = new MicroPoint(100, 100);
3232
this.minRotation = -360;
3333
this.maxRotation = 360;
3434
this.gravity = 0;
3535
this.particleClass = null;
36-
this.particleDrag = new Point();
36+
this.particleDrag = new MicroPoint();
3737
this.frequency = 0.1;
3838
this.lifespan = 3;
3939
this.bounce = 0;
4040
this._quantity = 0;
4141
this._counter = 0;
4242
this._explode = true;
4343
this.on = false;
44-
this._point = new Point();
44+
this._point = new MicroPoint();
4545
}
4646

4747
/**
@@ -68,18 +68,18 @@ module Phaser {
6868
* The minimum possible velocity of a particle.
6969
* The default value is (-100,-100).
7070
*/
71-
public minParticleSpeed: Point;
71+
public minParticleSpeed: MicroPoint;
7272

7373
/**
7474
* The maximum possible velocity of a particle.
7575
* The default value is (100,100).
7676
*/
77-
public maxParticleSpeed: Point;
77+
public maxParticleSpeed: MicroPoint;
7878

7979
/**
8080
* The X and Y drag component of particles launched from the emitter.
8181
*/
82-
public particleDrag: Point;
82+
public particleDrag: MicroPoint;
8383

8484
/**
8585
* The minimum possible angular velocity of a particle. The default value is -360.
@@ -149,7 +149,7 @@ module Phaser {
149149
/**
150150
* Internal point object, handy for reusing for memory mgmt purposes.
151151
*/
152-
private _point: Point;
152+
private _point: MicroPoint;
153153

154154
/**
155155
* Clean up memory.

Phaser/geom/Circle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ module Phaser {
262262
**/
263263
get isEmpty(): bool {
264264

265-
if (this._diameter < 1)
265+
if (this._diameter <= 0)
266266
{
267267
return true;
268268
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ V0.9.4
2626
* Added GameObject.renderRotation boolean to control if the sprite will visually rotate or not (useful when angle needs to change but graphics don't)
2727
* Added additional check to Camera.width/height so you cannot set them larger than the Stage size
2828
* Added Collision.separateTile and Tilemap.collide
29+
* Fixed: Made World._cameras public, World.cameras and turned Game.camera into a getter for it (thanks Hackmaniac)
30+
* Fixed: Circle.isEmpty properly checks diameter (thanks bapuna)
31+
2932

3033

3134
Requirements

Tests/Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@
9696
<TypeScriptCompile Include="sprites\dynamic texture 1.ts" />
9797
</ItemGroup>
9898
<ItemGroup>
99+
<Content Include="tweens\properties.js">
100+
<DependentUpon>properties.ts</DependentUpon>
101+
</Content>
102+
<TypeScriptCompile Include="tweens\properties.ts" />
99103
<TypeScriptCompile Include="misc\screen grab.ts" />
100104
<Content Include="misc\screen grab.js">
101105
<DependentUpon>screen grab.ts</DependentUpon>

Tests/phaser.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8486,6 +8486,7 @@ var Phaser;
84868486
this.onStart.dispatch(this._object);
84878487
this._startTime = this._game.time.now + this._delayTime;
84888488
for(var property in this._valuesEnd) {
8489+
console.log(typeof property);
84898490
// This prevents the interpolation of null values or of non-existing properties
84908491
if(this._object[property] === null || !(property in this._object)) {
84918492
throw Error('Phaser.Tween interpolation of null value of non-existing property');
@@ -10509,21 +10510,21 @@ var Phaser;
1050910510
this.y = Y;
1051010511
this.width = 0;
1051110512
this.height = 0;
10512-
this.minParticleSpeed = new Phaser.Point(-100, -100);
10513-
this.maxParticleSpeed = new Phaser.Point(100, 100);
10513+
this.minParticleSpeed = new Phaser.MicroPoint(-100, -100);
10514+
this.maxParticleSpeed = new Phaser.MicroPoint(100, 100);
1051410515
this.minRotation = -360;
1051510516
this.maxRotation = 360;
1051610517
this.gravity = 0;
1051710518
this.particleClass = null;
10518-
this.particleDrag = new Phaser.Point();
10519+
this.particleDrag = new Phaser.MicroPoint();
1051910520
this.frequency = 0.1;
1052010521
this.lifespan = 3;
1052110522
this.bounce = 0;
1052210523
this._quantity = 0;
1052310524
this._counter = 0;
1052410525
this._explode = true;
1052510526
this.on = false;
10526-
this._point = new Phaser.Point();
10527+
this._point = new Phaser.MicroPoint();
1052710528
}
1052810529
Emitter.prototype.destroy = /**
1052910530
* Clean up memory.

Tests/tilemap/collision.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@
2727
]);
2828
emitter = myGame.createEmitter(32, 80);
2929
emitter.width = 700;
30-
emitter.makeParticles('melon', 100, 0, false, 1);
30+
emitter.makeParticles('melon', 100, 0, false, 0);
3131
emitter.gravity = 200;
3232
emitter.bounce = 0.8;
33-
//emitter.setRotation(0, 0);
3433
emitter.start(false, 10, 0.1);
3534
car = myGame.createSprite(250, 64, 'ufo');
3635
car.renderRotation = false;

Tests/tilemap/collision.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
emitter = myGame.createEmitter(32, 80);
3636
emitter.width = 700;
37-
emitter.makeParticles('melon', 100, 0, false, 1);
37+
emitter.makeParticles('melon', 100, 0, false, 0);
3838
emitter.gravity = 200;
3939
emitter.bounce = 0.8;
4040
emitter.start(false, 10, 0.1);

0 commit comments

Comments
 (0)