mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
Updating core objects.
This commit is contained in:
parent
d8adad4294
commit
3020e3b8cf
3 changed files with 82 additions and 7 deletions
44
src/gameobjects/BaseGameObject.js
Normal file
44
src/gameobjects/BaseGameObject.js
Normal 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
|
||||
}
|
||||
|
||||
};
|
|
@ -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
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue