Fixed an error that stopped 2 tweens from being able to run on the same object. Also refactored a lot of the classes to remove prototype properties and move them to local instance properties.

This commit is contained in:
Richard Davey
2013-09-10 20:40:34 +01:00
parent a486bf6b4a
commit e41e35fd09
23 changed files with 533 additions and 558 deletions
+23 -29
View File
@@ -14,9 +14,32 @@ Phaser.Camera = function (game, id, x, y, width, height) {
// The view into the world we wish to render (by default the game dimensions)
// The x/y values are in world coordinates, not screen coordinates, the width/height is how many pixels to render
// Objects outside of this view are not rendered (unless set to ignore the Camera, i.e. UI?)
/**
* Camera view.
* @type {Rectangle}
*/
this.view = new Phaser.Rectangle(x, y, width, height);
this.screenView = new Phaser.Rectangle(x, y, width, height);
/**
* Sprite moving inside this Rectangle will not cause camera moving.
* @type {Rectangle}
*/
this.deadzone = null;
/**
* Whether this camera is visible or not. (default is true)
* @type {bool}
*/
this.visible = true;
/**
* If the camera is tracking a Sprite, this is a reference to it, otherwise null
* @type {Sprite}
*/
this.target = null;
};
@@ -28,35 +51,6 @@ Phaser.Camera.FOLLOW_TOPDOWN_TIGHT = 3;
Phaser.Camera.prototype = {
game: null,
world: null,
id: 0,
/**
* Camera view.
* @type {Rectangle}
*/
view: null,
/**
* Sprite moving inside this Rectangle will not cause camera moving.
* @type {Rectangle}
*/
deadzone: null,
/**
* Whether this camera is visible or not. (default is true)
* @type {bool}
*/
visible: true,
/**
* If the camera is tracking a Sprite, this is a reference to it, otherwise null
* @type {Sprite}
*/
target: null,
/**
* Tells this camera which sprite to follow.
* @param target {Sprite} The object you want the camera to track. Set to null to not follow anything.
+7 -6
View File
@@ -1,14 +1,15 @@
Phaser.LinkedList = function () {
this.next = null;
this.prev = null;
this.first = null;
this.last = null;
this.total = 0;
};
Phaser.LinkedList.prototype = {
next: null,
prev: null,
first: null,
last: null,
total: 0,
sprite: { name: 'HD' },
add: function (child) {
-6
View File
@@ -36,12 +36,6 @@ Phaser.Stage = function (game, width, height) {
Phaser.Stage.prototype = {
_onChange: null,
canvas: null,
bounds: null,
offset: null,
boot: function () {
Phaser.Canvas.getOffset(this.canvas, this.offset);
+25 -7
View File
@@ -11,6 +11,22 @@
*/
Phaser.State = function () {
this.game = null;
this.add = null;
this.camera = null;
this.cache = null;
this.input = null;
this.load = null;
// this.math = null;
this.sound = null;
this.stage = null;
this.time = null;
this.tweens = null;
this.world = null;
this.particles = null;
this.physics = null;
};
Phaser.State.prototype = {
@@ -18,17 +34,19 @@ Phaser.State.prototype = {
link: function (game) {
this.game = game;
// this.add = game.add;
// this.camera = game.camera;
this.add = game.add;
this.camera = game.camera;
this.cache = game.cache;
// this.input = game.input;
this.input = game.input;
this.load = game.load;
this.math = game.math;
// this.sound = game.sound;
// this.stage = game.stage;
// this.math = game.math;
this.sound = game.sound;
this.stage = game.stage;
this.time = game.time;
this.tweens = game.tweens;
// this.world = game.world;
this.world = game.world;
this.particles = game.particles;
this.physics = game.physics;
},
+4 -4
View File
@@ -3,15 +3,15 @@ Phaser.World = function (game) {
this.game = game;
this.bounds = new Phaser.Rectangle(0, 0, game.width, game.height);
this.camera = null;
this.currentRenderOrderID = 0;
};
Phaser.World.prototype = {
bounds: null,
camera: null,
currentRenderOrderID: 0,
boot: function () {