HTML5 neon effect and falling stars made with Phaser to give life to your title screens

When you make a game, any kind of game, no matter how minimal you want it to look, you should always keep an eye on the title screen, because all in all it’s the first thing players will see when trying your game.

I already blogged about it more than two years ago in the post how to bring your HTML5 games title screen to life in a minute with Phaser, and today we’ll see a nice neon effect made in a couple of lines which I am using for my upcoming game (and tutorial) Alien Drop, which is just a Pudi clone I am making to show you how to create an addictive game in a few lines.

Back to our neon effect, have a look:

Press “play” button to change colors. If you have a mobile phone, you can point your browser directly to this link.

There’s a neon effect made just overlapping the same sprites – the title and the play button – with different colors and making the one below randomly move, and a falling stars effect with is made with a particle emitter, then applying a tint effect to each particle.

Let’s have a look at the source code:

Let’s have a look at the most interesting lines:

Lines 24-34: this is the particle effect. It’s quite intuitive, you can set the alpha, the size, and so on.

Lines 35-37: here we tint each particle with a random color picked in the colors array defined at line 5.

Lines 38-40: here we place the background title image and we assign it a random tint color.

Lines 41-43: same thing goes for the the foreground title image.

Lines 44-51: the same concept of the double image is applied to play button.

Line 54: this single line, executed at each frame since it’s inside update function, is responsible for the neon effect of the title. We simply move background image by a small amount of pixels from its original position, and at line 55 we do the same thing with the background image of the play button.

And we made a simple but effective title screen in a few lines.

During next days I will give you more hints about the creation of interesting effects, meanwhile you can download the source code.