Assignment 5: “Pokémon, The Level-Up Update”

Objectives

  • Read and understand all of the Pokémon source code from Lecture 5.
  • Implement a Menu that appears during the player Pokémon’s level up that shows, for each stat, ‘X + Y = Z’, where X is the starting stat, Y is the amount it’s increased for this level, and Z is the resultant sum. This Menu should appear right after the “Level Up” dialogue that appears at the end of a victory where the player has indeed leveled up.

Getting Started

GitHub Classroom

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

  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/assignment5-summer2019-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/assignment5-summer2019-username repository: always push your code to your username/assignment5-summer2019-username repository.

Setup

Time to pull down the starting code for Pokémon! First, on your main repository page (https://github.com/username/assignment5-summer2019-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 assignment5-summer2019

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 assignment5-summer2019 to enter your repository.

Next-Level

Welcome to your sixth assignment! This week’s code will probably be the most complicated we’ll look at during the semester, but the assignment itself is fairly small in comparison; you will, however, need to know how many of the pieces work and fit together in order to accomplish the task ahead.

Your goal this assignment:

  • Implement a Menu that appears during the player Pokémon’s level up that shows, for each stat, ‘X + Y = Z’, where X is the starting stat, Y is the amount it’s increased for this level, and Z is the resultant sum. This Menu should appear right after the “Level Up” dialogue that appears at the end of a victory where the player has indeed leveled up. The area where most of this will take place is the TakeTurnState, specifically in the :victory() function, where the actual detection of a level up takes place. Ordinarily, just a BattleMessageState gets pushed onto the StateStack, but we’ll need to go a step further and push an additional Menu in order to accomplish what we’re after. This Menu should not have a cursor like the other Menu we’re used to seeing (in the BattleMenuState!), so you’ll need to customize the Selection class a little bit in order to take a boolean value to turn the cursor on or off as needed (defaulting to true if needed to preserve the behavior of the Menu in the BattleMenuState). Note that the :levelUp() function in the Pokemon class returns all of the stat increases we need in order to display things properly, so be sure to use those returned values when creating the Menu! As long as you get a proper grasp on the Selection, Menu, and StateStack classes, this assignment should be relatively straightforward in comparison to the complexity of this week’s code as a whole!

How to Submit

Step 1 of 1

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

Congratulations! You’ve completed Assignment 5.