diff --git a/Docs/phaser_tilemap_collision.png b/Docs/phaser_tilemap_collision.png
new file mode 100644
index 00000000..8b5ffbbf
Binary files /dev/null and b/Docs/phaser_tilemap_collision.png differ
diff --git a/Phaser/Game.ts b/Phaser/Game.ts
index 3c60d426..e7161499 100644
--- a/Phaser/Game.ts
+++ b/Phaser/Game.ts
@@ -80,7 +80,6 @@ module Phaser {
public onRenderCallback = null;
public onPausedCallback = null;
- public camera: Camera; // quick reference to the default created camera, access the rest via .world
public cache: Cache;
public collision: Collision;
public input: Input;
@@ -330,7 +329,6 @@ module Phaser {
this.onUpdateCallback = null;
this.onRenderCallback = null;
this.onPausedCallback = null;
- this.camera = null;
this.cache = null;
this.input = null;
this.loader = null;
@@ -422,6 +420,10 @@ module Phaser {
return this.collision.overlap(objectOrGroup1, objectOrGroup2, notifyCallback, Collision.separate);
}
+ public get camera(): Camera {
+ return this.world.cameras.current;
+ }
+
}
}
\ No newline at end of file
diff --git a/Phaser/World.ts b/Phaser/World.ts
index 51af8e17..1cefc5ff 100644
--- a/Phaser/World.ts
+++ b/Phaser/World.ts
@@ -16,9 +16,9 @@ module Phaser {
this._game = game;
- this._cameras = new CameraManager(this._game, 0, 0, width, height);
+ this.cameras = new CameraManager(this._game, 0, 0, width, height);
- this._game.camera = this._cameras.current;
+ this._game.camera = this.cameras.current;
this.group = new Group(this._game, 0);
@@ -29,8 +29,8 @@ module Phaser {
}
private _game: Game;
- private _cameras: CameraManager;
+ public cameras: CameraManager;
public group: Group;
public bounds: Rectangle;
public worldDivisions: number;
@@ -41,14 +41,14 @@ module Phaser {
this.group.update();
this.group.postUpdate();
- this._cameras.update();
+ this.cameras.update();
}
public render() {
// Unlike in flixel our render process is camera driven, not group driven
- this._cameras.render();
+ this.cameras.render();
}
@@ -56,7 +56,7 @@ module Phaser {
this.group.destroy();
- this._cameras.destroy();
+ this.cameras.destroy();
}
@@ -109,15 +109,15 @@ module Phaser {
// Cameras
public createCamera(x: number, y: number, width: number, height: number): Camera {
- return this._cameras.addCamera(x, y, width, height);
+ return this.cameras.addCamera(x, y, width, height);
}
public removeCamera(id: number): bool {
- return this._cameras.removeCamera(id);
+ return this.cameras.removeCamera(id);
}
public getAllCameras(): Camera[] {
- return this._cameras.getAll();
+ return this.cameras.getAll();
}
// Game Objects
diff --git a/Phaser/gameobjects/Emitter.ts b/Phaser/gameobjects/Emitter.ts
index 299872b4..2ed8f20c 100644
--- a/Phaser/gameobjects/Emitter.ts
+++ b/Phaser/gameobjects/Emitter.ts
@@ -27,13 +27,13 @@ module Phaser {
this.y = Y;
this.width = 0;
this.height = 0;
- this.minParticleSpeed = new Point(-100, -100);
- this.maxParticleSpeed = new Point(100, 100);
+ this.minParticleSpeed = new MicroPoint(-100, -100);
+ this.maxParticleSpeed = new MicroPoint(100, 100);
this.minRotation = -360;
this.maxRotation = 360;
this.gravity = 0;
this.particleClass = null;
- this.particleDrag = new Point();
+ this.particleDrag = new MicroPoint();
this.frequency = 0.1;
this.lifespan = 3;
this.bounce = 0;
@@ -41,7 +41,7 @@ module Phaser {
this._counter = 0;
this._explode = true;
this.on = false;
- this._point = new Point();
+ this._point = new MicroPoint();
}
/**
@@ -68,18 +68,18 @@ module Phaser {
* The minimum possible velocity of a particle.
* The default value is (-100,-100).
*/
- public minParticleSpeed: Point;
+ public minParticleSpeed: MicroPoint;
/**
* The maximum possible velocity of a particle.
* The default value is (100,100).
*/
- public maxParticleSpeed: Point;
+ public maxParticleSpeed: MicroPoint;
/**
* The X and Y drag component of particles launched from the emitter.
*/
- public particleDrag: Point;
+ public particleDrag: MicroPoint;
/**
* The minimum possible angular velocity of a particle. The default value is -360.
@@ -149,7 +149,7 @@ module Phaser {
/**
* Internal point object, handy for reusing for memory mgmt purposes.
*/
- private _point: Point;
+ private _point: MicroPoint;
/**
* Clean up memory.
diff --git a/Phaser/geom/Circle.ts b/Phaser/geom/Circle.ts
index 37e0d885..94976958 100644
--- a/Phaser/geom/Circle.ts
+++ b/Phaser/geom/Circle.ts
@@ -262,7 +262,7 @@ module Phaser {
**/
get isEmpty(): bool {
- if (this._diameter < 1)
+ if (this._diameter <= 0)
{
return true;
}
diff --git a/README.md b/README.md
index ff5efa42..e22ad697 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,9 @@ V0.9.4
* Added GameObject.renderRotation boolean to control if the sprite will visually rotate or not (useful when angle needs to change but graphics don't)
* Added additional check to Camera.width/height so you cannot set them larger than the Stage size
* Added Collision.separateTile and Tilemap.collide
+* Fixed: Made World._cameras public, World.cameras and turned Game.camera into a getter for it (thanks Hackmaniac)
+* Fixed: Circle.isEmpty properly checks diameter (thanks bapuna)
+
Requirements
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 700bd89b..34c3d34d 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -96,6 +96,10 @@
+
+ properties.ts
+
+
screen grab.ts
diff --git a/Tests/phaser.js b/Tests/phaser.js
index d96b2a94..57848c1b 100644
--- a/Tests/phaser.js
+++ b/Tests/phaser.js
@@ -8486,6 +8486,7 @@ var Phaser;
this.onStart.dispatch(this._object);
this._startTime = this._game.time.now + this._delayTime;
for(var property in this._valuesEnd) {
+ console.log(typeof property);
// This prevents the interpolation of null values or of non-existing properties
if(this._object[property] === null || !(property in this._object)) {
throw Error('Phaser.Tween interpolation of null value of non-existing property');
@@ -10509,13 +10510,13 @@ var Phaser;
this.y = Y;
this.width = 0;
this.height = 0;
- this.minParticleSpeed = new Phaser.Point(-100, -100);
- this.maxParticleSpeed = new Phaser.Point(100, 100);
+ this.minParticleSpeed = new Phaser.MicroPoint(-100, -100);
+ this.maxParticleSpeed = new Phaser.MicroPoint(100, 100);
this.minRotation = -360;
this.maxRotation = 360;
this.gravity = 0;
this.particleClass = null;
- this.particleDrag = new Phaser.Point();
+ this.particleDrag = new Phaser.MicroPoint();
this.frequency = 0.1;
this.lifespan = 3;
this.bounce = 0;
@@ -10523,7 +10524,7 @@ var Phaser;
this._counter = 0;
this._explode = true;
this.on = false;
- this._point = new Phaser.Point();
+ this._point = new Phaser.MicroPoint();
}
Emitter.prototype.destroy = /**
* Clean up memory.
diff --git a/Tests/tilemap/collision.js b/Tests/tilemap/collision.js
index 28ff6a33..42e4384a 100644
--- a/Tests/tilemap/collision.js
+++ b/Tests/tilemap/collision.js
@@ -27,10 +27,9 @@
]);
emitter = myGame.createEmitter(32, 80);
emitter.width = 700;
- emitter.makeParticles('melon', 100, 0, false, 1);
+ emitter.makeParticles('melon', 100, 0, false, 0);
emitter.gravity = 200;
emitter.bounce = 0.8;
- //emitter.setRotation(0, 0);
emitter.start(false, 10, 0.1);
car = myGame.createSprite(250, 64, 'ufo');
car.renderRotation = false;
diff --git a/Tests/tilemap/collision.ts b/Tests/tilemap/collision.ts
index cd59bde4..480c436d 100644
--- a/Tests/tilemap/collision.ts
+++ b/Tests/tilemap/collision.ts
@@ -34,7 +34,7 @@
emitter = myGame.createEmitter(32, 80);
emitter.width = 700;
- emitter.makeParticles('melon', 100, 0, false, 1);
+ emitter.makeParticles('melon', 100, 0, false, 0);
emitter.gravity = 200;
emitter.bounce = 0.8;
emitter.start(false, 10, 0.1);
diff --git a/Tests/tweens/properties.js b/Tests/tweens/properties.js
new file mode 100644
index 00000000..5c771ad6
--- /dev/null
+++ b/Tests/tweens/properties.js
@@ -0,0 +1,22 @@
+///
+(function () {
+ var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
+ function init() {
+ myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
+ myGame.loader.load();
+ }
+ var atari;
+ function create() {
+ atari = myGame.createSprite(300, 0, 'atari');
+ startBounceTween();
+ }
+ function startBounceTween() {
+ atari.y = 0;
+ var bounce = myGame.createTween(atari);
+ bounce.to({
+ x: 2
+ }, 1000 + Math.random() * 3000, Phaser.Easing.Bounce.Out);
+ bounce.onComplete.add(startBounceTween, this);
+ bounce.start();
+ }
+})();
diff --git a/Tests/tweens/properties.ts b/Tests/tweens/properties.ts
new file mode 100644
index 00000000..8d33415f
--- /dev/null
+++ b/Tests/tweens/properties.ts
@@ -0,0 +1,36 @@
+///
+
+(function () {
+
+ var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
+
+ function init() {
+
+ myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
+
+ myGame.loader.load();
+
+ }
+
+ var atari: Phaser.Sprite;
+
+ function create() {
+
+ atari = myGame.createSprite(300, 0, 'atari');
+
+ startBounceTween();
+ }
+
+ function startBounceTween() {
+
+ atari.y = 0;
+
+ var bounce: Phaser.Tween = myGame.createTween(atari);
+
+ bounce.to({ x: 2 }, 1000 + Math.random() * 3000, Phaser.Easing.Bounce.Out);
+ bounce.onComplete.add(startBounceTween, this);
+ bounce.start();
+
+ }
+
+})();
diff --git a/build/phaser.js b/build/phaser.js
index d96b2a94..57848c1b 100644
--- a/build/phaser.js
+++ b/build/phaser.js
@@ -8486,6 +8486,7 @@ var Phaser;
this.onStart.dispatch(this._object);
this._startTime = this._game.time.now + this._delayTime;
for(var property in this._valuesEnd) {
+ console.log(typeof property);
// This prevents the interpolation of null values or of non-existing properties
if(this._object[property] === null || !(property in this._object)) {
throw Error('Phaser.Tween interpolation of null value of non-existing property');
@@ -10509,13 +10510,13 @@ var Phaser;
this.y = Y;
this.width = 0;
this.height = 0;
- this.minParticleSpeed = new Phaser.Point(-100, -100);
- this.maxParticleSpeed = new Phaser.Point(100, 100);
+ this.minParticleSpeed = new Phaser.MicroPoint(-100, -100);
+ this.maxParticleSpeed = new Phaser.MicroPoint(100, 100);
this.minRotation = -360;
this.maxRotation = 360;
this.gravity = 0;
this.particleClass = null;
- this.particleDrag = new Phaser.Point();
+ this.particleDrag = new Phaser.MicroPoint();
this.frequency = 0.1;
this.lifespan = 3;
this.bounce = 0;
@@ -10523,7 +10524,7 @@ var Phaser;
this._counter = 0;
this._explode = true;
this.on = false;
- this._point = new Phaser.Point();
+ this._point = new Phaser.MicroPoint();
}
Emitter.prototype.destroy = /**
* Clean up memory.