phaser/src/gameobjects/Graphics.js

80 lines
1.6 KiB
JavaScript
Raw Normal View History

Phaser.Graphics = function (game, x, y) {
2013-09-22 14:21:51 +00:00
PIXI.Graphics.call(this);
2013-09-22 14:21:51 +00:00
Phaser.Sprite.call(this, game, x, y);
this.type = Phaser.GRAPHICS;
};
2013-09-22 14:21:51 +00:00
Phaser.Graphics.prototype = Object.create( PIXI.Graphics.prototype );
Phaser.Graphics.prototype.constructor = Phaser.Graphics;
2013-09-22 14:21:51 +00:00
Phaser.Graphics.prototype = Phaser.Utils.extend(true, Phaser.Graphics.prototype, Phaser.Sprite.prototype);
// Add our own custom methods
/**
* Automatically called by World.update
*/
2013-09-22 14:21:51 +00:00
Phaser.Graphics.prototype.OLDupdate = function() {
2013-09-22 14:21:51 +00:00
// if (!this.exists)
// {
// return;
// }
2013-09-22 14:21:51 +00:00
// this._cache.dirty = false;
2013-09-22 14:21:51 +00:00
// this._cache.x = this.x - (this.game.world.camera.x * this.scrollFactor.x);
// this._cache.y = this.y - (this.game.world.camera.y * this.scrollFactor.y);
2013-09-22 14:21:51 +00:00
// if (this.position.x != this._cache.x || this.position.y != this._cache.y)
// {
// this.position.x = this._cache.x;
// this.position.y = this._cache.y;
// this._cache.dirty = true;
// }
}
2013-09-22 14:21:51 +00:00
/*
Object.defineProperty(Phaser.Graphics.prototype, 'angle', {
get: function() {
return Phaser.Math.radToDeg(this.rotation);
},
set: function(value) {
this.rotation = Phaser.Math.degToRad(value);
}
});
Object.defineProperty(Phaser.Graphics.prototype, 'x', {
get: function() {
return this.position.x;
},
set: function(value) {
this.position.x = value;
}
});
Object.defineProperty(Phaser.Graphics.prototype, 'y', {
get: function() {
return this.position.y;
},
set: function(value) {
this.position.y = value;
}
});
2013-09-22 14:21:51 +00:00
*/