hellspawn_bg Posted November 21, 2014 Share Posted November 21, 2014 Upon game over I am trying to render the screen on a texture which would be passed on the next state as a background. Sofar I have implemented this, but I end up with a black screen instead. In the game state I do this:this.texture= new Phaser.RenderTexture(this.game, this.game.width, this.game.height);this.texture.renderXY(this.game.stage, 0, 0);In the new state I set the texture as a background:this.background = new Phaser.Sprite(this.game, 0, 0, this.texture);Any ideas? Thanks Link to comment Share on other sites More sharing options...
lewster32 Posted November 21, 2014 Share Posted November 21, 2014 Have you tried this.game.world instead of this.game.stage? Link to comment Share on other sites More sharing options...
valueerror Posted November 22, 2014 Share Posted November 22, 2014 this works for me... the texture from one level is added in the next level..fade out is triggered to change the state....game.add.existing is done in the new statefunction fadeOut(target){ texture = new PIXI.RenderTexture(game.width, game.height, game.renderer); matrix = new PIXI.Matrix(); matrix.translate(-game.camera.x, -game.camera.y); texture.render(game.world, matrix); cover = new Phaser.Sprite(game, 0, 0, texture); cover.fixedToCamera = true; cover.anchor.setTo(0.5,0.5); cover.cameraOffset.x = game.width / 2; cover.cameraOffset.y = game.height / 2; game.state.start(''+target+''); } if (cover) {game.add.existing(cover)} Tilde 1 Link to comment Share on other sites More sharing options...
Recommended Posts