Testing some new Camera tricks.

This commit is contained in:
Richard Davey
2013-10-03 23:20:24 +01:00
parent c8760b4341
commit 54f073e5cb
12 changed files with 171 additions and 24 deletions
+8
View File
@@ -78,6 +78,8 @@ Phaser.Camera = function (game, id, x, y, width, height) {
* @default
*/
this._edge = 0;
this.displayObject = null;
};
@@ -166,6 +168,8 @@ Phaser.Camera.prototype = {
*/
update: function () {
return;
// Add dirty flag
if (this.target !== null)
@@ -216,6 +220,8 @@ Phaser.Camera.prototype = {
*/
checkWorldBounds: function () {
return;
this.atLimit.x = false;
this.atLimit.y = false;
@@ -293,6 +299,7 @@ Object.defineProperty(Phaser.Camera.prototype, "x", {
set: function (value) {
this.view.x = value;
this.displayObject.x = -value;
this.checkWorldBounds();
}
@@ -311,6 +318,7 @@ Object.defineProperty(Phaser.Camera.prototype, "y", {
set: function (value) {
this.view.y = value;
this.displayObject.y = -value;
this.checkWorldBounds();
}
+4 -3
View File
@@ -54,12 +54,13 @@ Phaser.World.prototype = {
*/
boot: function () {
this.group = new Phaser.Group(this.game, null, '__world', false);
this.camera = new Phaser.Camera(this.game, 0, 0, 0, this.game.width, this.game.height);
this.camera.displayObject = this.group;
this.game.camera = this.camera;
this.group = new Phaser.Group(this.game, null, '__world', true);
},
/**
@@ -77,7 +78,7 @@ Phaser.World.prototype = {
{
var currentNode = this.game.stage._stage.first._iNext;
do
do
{
if (currentNode['preUpdate'])
{