Updating core objects.

This commit is contained in:
photonstorm 2016-10-14 08:59:24 +01:00
parent d8adad4294
commit 3020e3b8cf
3 changed files with 82 additions and 7 deletions

View file

@ -0,0 +1,44 @@
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2016 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
Phaser.GameObject = function (game)
{
this.game = game;
this.name = '';
this.parent = null;
this.children = null;
this.transform = null;
};
Phaser.GameObject.prototype.constructor = Phaser.GameObject;
Phaser.GameObject.prototype = {
preUpdate: function ()
{
// NOOP
},
update: function ()
{
// NOOP
},
postUpdate: function ()
{
// NOOP
},
render: function ()
{
// NOOP
}
};

View file

@ -8,8 +8,37 @@ Phaser.GameObject = function (game)
{
this.game = game;
this.name = '';
this.parent = null;
this.children = null;
this.transform = null;
};
Phaser.GameObject.prototype.constructor = Phaser.GameObject;
Phaser.GameObject.prototype = {
preUpdate: function ()
{
// NOOP
},
update: function ()
{
// NOOP
},
postUpdate: function ()
{
// NOOP
},
render: function ()
{
// NOOP
}
};

View file

@ -55,10 +55,12 @@ Phaser.GameObject.Sprite = function (game, x, y, key, frame)
this.data = new Phaser.Component.Data(this);
this.color = new Phaser.Component.Color(this);
// Temporary for now?
this.alpha = 1;
this.worldAlpha = 1;
this.blendMode = Phaser.blendModes.NORMAL;
// this.alpha = 1;
// this.worldAlpha = 1;
// this.blendMode = Phaser.blendModes.NORMAL;
this.scaleMode = Phaser.scaleModes.DEFAULT;
this.exists = true;
};
@ -74,10 +76,10 @@ Phaser.GameObject.Sprite.prototype.constructor = Phaser.GameObject.Sprite;
*/
Phaser.GameObject.Sprite.prototype.preUpdate = function ()
{
if (this.parent)
{
this.worldAlpha = this.alpha * this.parent.worldAlpha;
}
// if (this.parent)
// {
// this.worldAlpha = this.alpha * this.parent.worldAlpha;
// }
this.children.preUpdate();
};