Flappy Bird

Objectives

  • Influence the generation of pipes so as to bring about more complicated level design.
  • Give the player a medal for their performance, along with their score.
  • Implement a pause feature, just in case life gets in the way of jumping through pipes!

Getting Started

Download the distribution code for your game from cdn.cs50.net/2d/2025/x/projects/1/flappy.zip and unzip flappy.zip, which should yield a directory called flappy.

Then, in a terminal window (located in /Applications/Utilities on Mac or by typing cmd in the Windows task bar), move to the directory where you extracted flappy and run

cd flappy

Flapping Your Wings

Your second assignment won’t be quite as easy as the last, but don’t worry! The pieces, taken one at a time, are still quite bite-sized and manageable and will mainly be a recap of what we’ve covered thoroughly in lecture leading up to this point! For a refresher on LÖVE, as well as some helpful links for getting started, do just visit the following:

https://love2d.org/

https://love2d.org/wiki/Getting_Started

Be sure to watch Lecture 1 and read through the code so you have a firm understanding of how it works before diving in! In particular, take note of where the logic is for spawning pipes and the parameters that drive both the gap between pipes and the interval at which pipes spawn, as those will be two primary components of this update! You’ll be making some notable changes to the ScoreState, so be sure to read through that as well and get a sense for how images are stored, since you’ll be incorporating your own. Lastly, think about what you need in order to incorporate a pause feature (a simple version of which we saw in lecture!). And if we want to pause the music, we’ll probably need a method to do this that belongs to the audio object LÖVE gives us when we call love.audio.newSource; try browsing the documentation on the LÖVE wiki to find out what it is!

Specification

  • Vertical gaps. Randomize the gap between pipes (vertical space), such that they’re no longer hardcoded to 90 pixels.
  • Horizontal gaps. Randomize the interval at which pairs of pipes spawn, such that they’re no longer always 2 seconds apart.
  • Medals. When a player enters the ScoreState, award them a “medal” via an image displayed along with the score; this can be any image or any type of medal you choose (e.g., ribbons, actual medals, trophies, etc.), so long as each is different and based on the points they scored that life. Choose 3 different ones, as well as the minimum score needed for each one (though make it fair and not too hard to test!).
  • Pause. Implement a pause feature, such that the user can simply press “P” (or some other key) and pause the state of the game. This pause effect will be slightly fancier than the pause feature we showed in class, though not ultimately that much different. When they pause the game, a simple sound effect should play (I recommend testing out bfxr or ChipTone for this, as seen in Lecture 0). At the same time this sound effect plays, the music should pause, and once the user presses P again, the gameplay and the music should resume just as they were! To cap it off, display a pause icon in the middle of the screen, nice and large, so as to make it clear the game is paused.

Errata

NONE

How to Submit

When you submit your project, the contents of your branch must match the file structure of the unzipped distribution code exactly as originally received. That is to say, your files should not be nested inside of any other directories of your own creation or otherwise deviate from the file structure we gave you. Your branch should also not contain any code from any other projects, only this one. Failure to adhere to this file structure will result in your submission being rejected.

  1. If you haven’t already, visit this link, log in with your GitHub account, and click Authorize cs50. Then, check the box indicating that you’d like to grant course staff access to your submissions, and click Join course.
  2. Install Git and, optionally, install submit50.
  3. Using Git, push your work to https://github.com/me50/USERNAME.git, where USERNAME is your GitHub username, on a branch called games50/projects/2025/x/flappy or, if you’ve installed submit50, execute

    submit50 games50/projects/2025/x/flappy
    

    instead.

  4. Record a screencast, not to exceed 5 minutes in length in which you demonstrate your game’s functionality. Upload that video to YouTube (as unlisted or public, but not private). This video’s requirements are:
    • It is not a YouTube “short”.
    • The video begins with a slide or text overlay containing both your edX and GitHub usernames.
    • It must show your game live and in action. Do not use this video to walk us through any code.
    • It demonstrates that all four (4) items of the specification have been implemented.
    • The video description has been timestamped at the (first) point where your video demonstrates each of the above-referenced implementations.
    • The video has been uploaded less than one month from the time of your submission of the form for this project (the final step below).
  5. Submit this form.

You can then go to https://cs50.me/cs502d to view your current progress!