ps786 Posted September 30, 2016 Share Posted September 30, 2016 Hi, i'm creating a gameover screen and i made it .. now i want color faded or like an overlay screen around gameover screen group. this is the code snippet i'm using ... this.gameOverScreenGroup = this.game.add.group(); this.gameOverScreenGroup.x = 197; this.gameOverScreenGroup.y = 52; /* var gameOverBGScreen = this.game.add.bitmapData(this.game.width,this.game.height); gameOverBGScreen.ctx.fillStyle = "#d5d2cc" gameOverBGScreen.ctx.fillRect(0,0,this.game.width,this.game.height) */ /* Game Over screen BG */ this.gameOverBG = this.game.add.graphics(0,0,this.gameOverScreenGroup); // this.gameOverBG.lineStyle(2, 0xFFFF00, 1.0); this.gameOverBG.drawRoundedRect(0,0,630,600,10); this.gameOverBG.beginFill(0xfaecbe, 1); this.gameOverBG.drawRoundedRect(0,0,630,600,10); this.gameOverBG.endFill(); this.gameOverBG.width = 630; this.gameOverBG.height = 600; // this.gameOverScreenGroup.add(gameOverBGScreen) this.gameOverScreenGroup.add(this.gameOverBG); //this.gameOverScreenGroup.x = this.gameOverBG.x; //this.gameOverScreenGroup.y = this.gameOverBG.y; var star_1 = this.game.add.sprite(60, 74,'UI', 'star',this.gameOverScreenGroup); var star_2 = this.game.add.sprite(star_1.width+110, 44,'UI', 'star',this.gameOverScreenGroup); var star_3 = this.game.add.sprite(star_2.width*2+160, 74,'UI', 'star',this.gameOverScreenGroup); this.nextBtn = this.game.add.sprite(209, 226,'UI', 'btn_next',this.gameOverScreenGroup); this.nextBtn.inputEnabled = false; Link to comment Share on other sites More sharing options...
lumoludo Posted September 30, 2016 Share Posted September 30, 2016 Are you just trying to get a semi transparent overlay drawn behind your menu? This is the code I use to do that: var bmd = game.add.bitmapData(1, 1); bmd.fill(0, 0, 0); var semiTransparentOverlay = game.add.sprite(0, 0, bmd); semiTransparentOverlay.scale.setTo(game.width, game.height); semiTransparentOverlay.alpha = 0; game.add.tween(semiTransparentOverlay).to({alpha:0.5}, 500, Phaser.Easing.Quadratic.In, true); In the future, when you make a new post, there is a button in the tool bar on this forum that will let you format your code to make it easier to read. That's what I used above to make the text look like it does. Link to comment Share on other sites More sharing options...
Recommended Posts