@@ -17,6 +17,17 @@ Phaser.Sprite = function (game, x, y, key, frame) {
1717
1818 this . name = '' ;
1919
20+ if ( key )
21+ {
22+ PIXI . Sprite . call ( this , PIXI . TextureCache [ key ] ) ;
23+ }
24+ else
25+ {
26+ // No texture yet
27+ console . log ( 'no texture yet' ) ;
28+ PIXI . Sprite . call ( this ) ;
29+ }
30+
2031 // this.events = new Phaser.Components.Events(this);
2132
2233 /**
@@ -25,7 +36,7 @@ Phaser.Sprite = function (game, x, y, key, frame) {
2536 */
2637 this . animations = new Phaser . AnimationManager ( this ) ;
2738
28- PIXI . DisplayObjectContainer . call ( this ) ;
39+ // PIXI.DisplayObjectContainer.call(this);
2940
3041 /**
3142 * The anchor sets the origin point of the texture.
@@ -44,7 +55,7 @@ Phaser.Sprite = function (game, x, y, key, frame) {
4455 * @property texture
4556 * @type Texture
4657 */
47- this . texture = PIXI . TextureCache [ key ] ;
58+ // this.texture = PIXI.TextureCache[key];
4859
4960 if ( this . game . cache . isSpriteSheet ( key ) )
5061 {
@@ -63,21 +74,9 @@ Phaser.Sprite = function (game, x, y, key, frame) {
6374 }
6475 }
6576
66- /**
67- * The blend mode of sprite.
68- * currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
69- *
70- * @property blendMode
71- * @type Number
72- */
73- // this.blendMode = PIXI.blendModes.NORMAL;
74-
7577 this . x = x ;
7678 this . y = y ;
7779
78- // this.updateFrame = true;
79- // this.renderable = true;
80-
8180 this . position . x = x ;
8281 this . position . y = y ;
8382
@@ -143,6 +142,7 @@ Phaser.Sprite = function (game, x, y, key, frame) {
143142
144143} ;
145144
145+ // Needed to keep the PIXI.Sprite constructor in the prototype chain (as the core pixi renderer uses an instanceof check sadly)
146146Phaser . Sprite . prototype = Object . create ( PIXI . Sprite . prototype ) ;
147147Phaser . Sprite . prototype . constructor = Phaser . Sprite ;
148148
0 commit comments