Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Make A Flappy Bird Game using JavaScript & P5.js framework
Rating: 4.6 out of 5(10 ratings)
53 students

Make A Flappy Bird Game using JavaScript & P5.js framework

Learn Coding By Making Classic Games
Created bySaran Siri
Last updated 9/2020
English
English

What you'll learn

  • Be able to declare and assign variables in JavaScript
  • Be able to use conditional statement and gravity in JavaScript
  • Be able to understand the foundation of 2D game including the setup and draw cycle
  • Be able to apply new idea to the existing game

Course content

1 section12 lectures38m total length
  • Introduction0:52

    Learn to build a Flappy Bird game with JavaScript and p5.js, using a free online editor to draw shapes, simulate gravity and jumping, and add pipes, collision detection, and scoring.

  • Basics7:02

    Explore the basics of the p5.js framework by using setup and draw, creating a 400 by 400 canvas with createCanvas, and coloring shapes with background, fill, and rect or ellipse.

  • Bird2:52

    Define a Bird class in JavaScript with x and y coordinates and a size, implement a draw method using ellipse, and render it in a p5.js sketch.

  • Drop3:39

    Update position with velocity and acceleration to simulate gravity, then apply gravity in the bird class, set a floor at 90% height, and stop movement on contact.

  • Flap3:07

    Learn to implement a jumping mechanic for a flappy bird clone in JavaScript with p5.js, triggered by mouse clicks or the space bar, via doAction and bird.jump, adjusting gravity.

  • Death4:14

    Create a health variable to kill the bird on floor or off-screen, preventing jumps when dead, and display a centered 'game over' in black. Add a reset function to restart.

  • Pipe3:35

    Create a pipe class in pipe.js with x, gapWidth, gapHeight, and topGap, using random and map to place the gap between 10% and 60% of height, and draw green rects.

  • Illusion4:00

    Create an illusion of infinite pipes using three pipe objects moving left, resetting off-screen with randomized top gaps, controlled by the bird's alive state and reset logic.

  • Collision3:09

    Implement collision logic for a flappy bird game by detecting pipe bounds, killing the bird on collision, and adjusting its floor to topGap plus gapHeight or floorY.

  • Score3:01

    Implement score tracking in a Flappy Bird game using JavaScript and p5.js, updating the bird's score and its hiscore as pipes are passed and displaying them on screen.

  • Final Touch2:24

    Increase pipe speed with the score using a pipeSpeed variable, and implement a freeze feature that unfreezes on input, showing 'Press a space key or click to jump' when frozen.

  • Share0:43

    Log in and save your project, then share your Flappy Bird game from the File menu to generate a full screen link, a standalone present link, or an embedded iframe.

Requirements

  • Basic knowledge of JavaScript or coding in general
  • Basic knowledge of web browser

Description

Make a simple, easy-to-follow, classic Flappy bird game, using javascript and p5 framework. We will be using a free online editor that runs on any web browser.

I will show you how to:

  • draw basic shapes, and make an object move.

  • draw a bird, make it drop to the ground by simulating the gravity.

  • make the bird jump, and also make it stop jumping when it is dead.

  • create moving pipes, and add a collision detection to the pipe.

  • add a score system, and make it harder.

You can follow me for more game tutorials. Now let’s open the next lesson, and get started!

Who this course is for:

  • Anyone who wants to learn coding
  • Anyone who loves games and wants to make games