Assignment 1: “Flappy Bird, The Reward Update”

Objectives

  • Read and understand all of the Flappy (Fifty!) Bird source code from Lecture 1.
  • Influence the generation of pipes so as to bring about more complicated level generation.
  • 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

GitHub Classroom

In this course, we’ll use GitHub Classroom to distribute projects and collect submissions. To begin Assignment 1:

  1. Click here to go to the GitHub Classroom page for starting the assignment.
  2. Click the green “Accept this assignment” button. This will create a GitHub repository for your project. Recall that a git repository is just a location where your code will be stored and which can be used to keep track of changes you make to your code over time.
  3. Click on the link that follows “Your assignment has been created here”, which will direct you to the GitHub repository page for your project. It may take a few seconds for GitHub to finish creating your repository.
  4. In the upper-right corner of the repository page, click the “Fork” button, and then (if prompted) click on your username. This will create a fork of your project repository, a version of the repository that belongs to your GitHub account.
  5. Now, you should be looking at a GitHub repository titled username/assignment1-username, where username is your GitHub username. This will be the repository to which you will push all of your code while working on your assignment. When working on the assignment, do not directly push to the games50/assignment1-username repository: always push your code to your username/assignment1-username repository.

Setup

Time to pull down the starting code for Flappy Bird, just like last week! First, on your main repository page (https://github.com/username/assignment1-username), click on the green “Clone or download” button. Copy the “Clone with HTTPS” link to your clipboard (if familiar with SSH, you can use that instead).

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 want to store your project on your computer (recall that the cd command can change your current directory), and run

git clone repository_url assignment1

where repository_url is the link you just copied from GitHub. You will be prompted for your GitHub username and password

Go ahead and run cd assignment1 to enter your repository.

Flapping Your Wings

Your second assignment won’t be quite as easy as last week’s, 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ÖVE2D, 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ÖVE2D wiki to find out what it is!

Your goals this assignment:

  • Randomize the gap between pipes (vertical space), such that they’re no longer hardcoded to 90 pixels.
  • Randomize the interval at which pairs of pipes spawn, such that they’re no longer always 2 seconds apart.
  • 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 :)).
  • 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 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.

How to Submit

Step 1 of 1

  1. Go to the GitHub page for your username/assignment1-username repository (note: this is different from the games50/assignment1-username repository).
  2. On the right side of the screen, click the Pull request button.
  3. Make sure that the “base fork” is games50/assignment1-username, and the “head fork” is username/assignment1-username.
  4. Click “Create pull request”.
  5. On the next page, click the “Create pull request” button again.

Congratulations! You’ve completed Assignment 1.