Make a Flappy Bird clone with Phaser

Flappy Bird – no info as anyone who may be reading this knows about it 😉

Phaser – open source desktop and mobile HTML5 game framework supporting both JavaScript and TypeScript

This is basically just an addition to the great 3 series tutorial (part 1, part 2, part 3) from LessMilk’s blog and hereby I thank him for them.

The original tutorial makes the bird (square) jump by pressing the space key, whilst to make the bird jump on a mouse click (or tap on mobile devices) all you have to do is replace the

var space_key = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);

in the menu.js  file with:

var space_key = this.game.input;

Also, I added the crash sound (original file from here) in the hit_pipe  function:

if (this.bird.alive == false){
    this.crash_sound.play();
    return;
}

which I’ve defined in the create  function:

this.crash_sound = this.game.add.audio('crash');

of the file play.js .

You can download this changed code from Github, and try out the game here.

Written by Nikola Brežnjak