How to Build Flappy Bird in JavaScript – GameDev Tutorial

Learn how to create a flappy bird game using pure JavaScript.

Download the Starter Template:

Download the final Game files:

Check out more great tutorials like this one on the Code Explained channel:

Learn to code for free and get a developer job:

Read hundreds of articles on programming:

And subscribe for new videos on technology every day:


This Post Has 23 Comments

  1. Deepak Sharma

    Great tutorial ! Where can I learn more javascript games?

  2. In my case images were not showing up. So, I added images in html and hide them using style then imported images in JS file using getelementbyid instead using image object as used in video example.

    HTML File:
    <img class="hide" src="images/bg.png" id="bg"/>
    JS File:
    var bg = document.getElementById('bg');
    cntx.drawImage(bg, 0, 0);

  3. Adam

    Are you the king of Javascript?

  4. Mista T

    The logic explaining part is what makes this tutorial one level above all other tutorials I've ever seen!

  5. RagHelen

    There is only one bug: That bird doesn't flap!

  6. atanki

    the starter template link is broken please help…. I really need to follow along with this tutorial cuz this is one of the best tutorials and you seem good so please if you can by any means make a media fire link……. pleasee!!!

  7. EvaOA

    hello, is this a mobile app?

  8. anil gr

    How do you ensure that the images are loaded, before you draw.

    In my system images are taking time to load. So nothing is drawn.(before requestAnimationFrame added)

  9. Anonymous

    how do u even put a bird image in a coding script

  10. Business Opportunity in Ruvol

    I have invented a Board Game [still unpublished and not yet out in the market] that I believe is guaranteed to be as challenging and exciting as CHESS. I called it “RUVOL.”

    It is my hope that one day Ruvol may surpass chess as the “Number One Board Game in the World.”

    The weakness of chess is it always starts in fixed positions that the opening moves become “memorizable.” In fact, not a few have so mastered the moves that they can play against their opponents “blindfolded.” It is for this very reason that the great Bobby Fischer introduced his so-called “Fischer Random Chess,” where the starting position of the pieces is “randomized” to make the memorization of openings impracticable. Fortunately, it is also for this reason that I invented Ruvol where “every game” has been calculated to be a challenging one to play.


    I detailed everything in my YouTube video. Here is the link:


    It is worthwhile to note that the people who play chess will be the same people who will play Ruvol. In my Google search, I learned there are around 800 million chess players in the world. Even just a small percentage of these 800 million is good enough to earn big money from Ruvol either as an ONLINE GAME BUSINESS or as a PHYSICAL PRODUCT DISTRIBUTOR.

    You may contact me at:

    Thanks and God bless!

    The Ruvol Inventor

  11. Şeymanur GÜNEY

    I cannot open starter template and final game files what is wrong with that…

Leave a Reply