mirror of
https://github.com/wassname/phaser.git
synced 2026-07-24 13:10:53 +08:00
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:
+23
-29
@@ -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.
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
@@ -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
@@ -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
@@ -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 () {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user