jzcodes Posted February 6, 2018 Share Posted February 6, 2018 (edited) Hello, I'm making a racing game (at least I'm trying to!) I'm using a setTimeout function to delay the start of the scrolling of the background by 3 seconds which works perfectly! But, what I really need now is to display an image of "3" *pause & fade out*, switch to image of "2" *pause & fade out*, switch to "1" *pause & fade out* then show "Go!" * fade out* I saw something where I set the alpha to 0 and then tween the alpha to 1 like so: game.add.tween(this.countDown).to({alpha: 1}, 1000, Phaser.Easing.Linear.None, true, 0, 1000, false); But this isn't exactly what I'm looking for. I'm not sure what all of these parameters are or how I would switch between the images (using different images or a spritesheet, I'm not sure what's best) to give the desired effect. Can someone please help me? Many thanks, and let me know if you need me to explain this better! Update: I kept hunting around (I apologize for not searching more thoroughly) but, I did come across chaining tweens. I'm trying it out but having some difficulty Edited February 6, 2018 by jzcodes Update Link to comment Share on other sites More sharing options...
jzcodes Posted February 7, 2018 Author Share Posted February 7, 2018 I figured it out!! It was a little tricky to find a clear description of the params but, this is what I did! var tween1 = game.add.tween(this.countDown1).to({alpha: 1}, 500, Phaser.Easing.Linear.None, false, 0).to({alpha: 0}, 500, Phaser.Easing.Linear.None, false, 0); var tween2 = game.add.tween(this.countDown2).to({alpha: 1}, 500, Phaser.Easing.Linear.None, false, 0).to({alpha: 0}, 500, Phaser.Easing.Linear.None, false, 0); var tween3 = game.add.tween(this.countDown3).to({alpha: 1}, 500, Phaser.Easing.Linear.None, false, 0).to({alpha: 0}, 500, Phaser.Easing.Linear.None, false, 0); var tweenGo = game.add.tween(this.countDownGo).to({alpha: 1}, 500, Phaser.Easing.Linear.None, false, 0).to({alpha: 0}, 500, Phaser.Easing.Linear.None, false, 0); tween3.chain(tween2); tween2.chain(tween1); tween1.chain(tweenGo); tween3.start(); jmat, Fenopiù and casey 3 Link to comment Share on other sites More sharing options...
Recommended Posts