diff --git a/README.md b/README.md
index 4f5d3259..b00b3007 100644
--- a/README.md
+++ b/README.md
@@ -143,6 +143,7 @@ New features:
* Tween.generateData(frameRate) allows you to generate tween data into an array, which can then be used however you wish (see new examples)
* Group.xy(index, x, y) allows you to set the x and y coordinates of a Group child at the given index.
* Group.reverse() reverses the display order of all children in the Group.
+* Tweens are now bound to their own TweenManager, not always the global game one. So you can create your own managers now (for you clark :)
Updates:
diff --git a/examples/_site/view_full.html b/examples/_site/view_full.html
index e1e83f85..d2c47e47 100644
--- a/examples/_site/view_full.html
+++ b/examples/_site/view_full.html
@@ -141,14 +141,26 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/_site/view_lite.html b/examples/_site/view_lite.html
index ed6e9f40..39714370 100644
--- a/examples/_site/view_lite.html
+++ b/examples/_site/view_lite.html
@@ -141,14 +141,26 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/basics/02 - click on an image.js b/examples/basics/02 - click on an image.js
index 56c8a0b5..b8c50417 100644
--- a/examples/basics/02 - click on an image.js
+++ b/examples/basics/02 - click on an image.js
@@ -1,7 +1,10 @@
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
-function preload() {
+var text;
+var counter = 0;
+
+function preload () {
// You can fill the preloader with as many assets as your game requires
@@ -10,24 +13,30 @@ function preload() {
// The second parameter is the URL of the image (relative)
game.load.image('einstein', 'assets/pics/ra_einstein.png');
+
}
function create() {
// This creates a simple sprite that is using our loaded image and
- // displays it on-screen
- // and assign it to a variable
- var image = game.add.sprite(0, 0, 'einstein');
+ // displays it on-screen and assign it to a variable
+ var image = game.add.sprite(game.world.centerX, game.world.centerY, 'einstein');
- //enables all kind of input actions on this image (click, etc)
- image.inputEnabled=true;
+ // Moves the image anchor to the middle, so it centers inside the game properly
+ image.anchor.set(0.5);
- image.events.onInputDown.add(listener,this);
+ // Enables all kind of input actions on this image (click, etc)
+ image.inputEnabled = true;
+ text = game.add.text(250, 16, '', { fill: '#ffffff' });
+ image.events.onInputDown.add(listener, this);
}
function listener () {
- alert('clicked');
+
+ counter++;
+ text.text = "You clicked " + counter + " times!";
+
}
diff --git a/examples/wip/fixed to cam scale.js b/examples/wip/fixed to cam scale.js
index 54fd908a..7e11aded 100644
--- a/examples/wip/fixed to cam scale.js
+++ b/examples/wip/fixed to cam scale.js
@@ -18,7 +18,7 @@ function create() {
game.world.setBounds(0, 0, 1920, 1200);
game.add.image(0, 0, 'backdrop');
- mushroom = game.add.sprite(400, 400, 'mushroom');
+ mushroom = game.add.sprite(100, 100, 'mushroom');
// Test Fixing an Image to the Camera
var fixie = game.add.image(100, 100, 'coke');
@@ -50,9 +50,12 @@ function create() {
// Button! do mouse events still work then?
- game.camera.scale.set(2);
+ // game.world.pivot.set(400, 300);
+ // game.camera.scale.set(2);
game.camera.follow(mushroom);
+ game.camera.deadzone = new Phaser.Rectangle(200, 150, 400, 300);
+ // game.camera.deadzone = new Phaser.Rectangle(0, 0, 800, 600);
cursors = game.input.keyboard.createCursorKeys();
diff --git a/src/core/Camera.js b/src/core/Camera.js
index 33e33293..f6eebd59 100644
--- a/src/core/Camera.js
+++ b/src/core/Camera.js
@@ -127,8 +127,8 @@ Phaser.Camera.prototype = {
/**
* Tells this camera which sprite to follow.
* @method Phaser.Camera#follow
- * @param {Phaser.Sprite} target - The object you want the camera to track. Set to null to not follow anything.
- * @param {number} [style] Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
+ * @param {Phaser.Sprite|Phaser.Image|Phaser.Text} target - The object you want the camera to track. Set to null to not follow anything.
+ * @param {number} [style] - Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
*/
follow: function (target, style) {
diff --git a/src/tween/Tween.js b/src/tween/Tween.js
index 30ba5c25..e598ffce 100644
--- a/src/tween/Tween.js
+++ b/src/tween/Tween.js
@@ -12,8 +12,9 @@
* @constructor
* @param {object} object - Target object will be affected by this tween.
* @param {Phaser.Game} game - Current game instance.
+* @param {Phaser.TweenManager} manager - The TweenManager responsible for looking after this Tween.
*/
-Phaser.Tween = function (object, game) {
+Phaser.Tween = function (object, game, manager) {
/**
* Reference to the target object.
@@ -31,7 +32,7 @@ Phaser.Tween = function (object, game) {
* @property {Phaser.TweenManager} _manager - Reference to the TweenManager.
* @private
*/
- this._manager = this.game.tweens;
+ this._manager = manager;
/**
* @property {object} _valuesStart - Private value object.
diff --git a/src/tween/TweenManager.js b/src/tween/TweenManager.js
index ed567fa7..b326d23b 100644
--- a/src/tween/TweenManager.js
+++ b/src/tween/TweenManager.js
@@ -81,6 +81,7 @@ Phaser.TweenManager.prototype = {
*/
add: function (tween) {
+ tween._manager = this;
this._add.push(tween);
},
@@ -94,7 +95,7 @@ Phaser.TweenManager.prototype = {
*/
create: function (object) {
- return new Phaser.Tween(object, this.game);
+ return new Phaser.Tween(object, this.game, this);
},