Flappy Bird Clone > Week 1 Progress

April 12, 2020

Overview

Key Changes

  • Setup bird.js and sketch.js and html wrapper for development using my p5.js template.

  • Modified the Bird object’s gravity and lift values (tweaking to continue):
    1
    2
    
    this.gravity = 0.4;
    this.lift = -15;
    
  • Modified it so that the bird cannot go off the screen:
    1
    2
    3
    4
    5
    
    if (!(this.y < 0 + this.height / 2) && !(this.y > height - this.height / 2)) {
      this.velocity += this.lift;
    } else {
      this.velocity = 0;
    }
    
  • Disabled the user ability to use the spacebar to scroll the browser, source:
    1
    2
    3
    4
    5
    6
    
    window.addEventListener("keydown", function (e) {
      // spacebar = 32
      if ([32].indexOf(e.keyCode) > -1) {
          e.preventDefault(); // prevents default browser behaviour when interacting with p5.js
      }
    }, false);
    

Current State

Next Steps

  • Tweak size/scale of the game objects
  • Background & parallax motion
  • Pipes / obstacles (difficulty levels)
  • Scoring
  • Graphics (toggle between shapes or icons)