Pokémon, the Level-Up Update
Objectives
- Read and understand all of the Pokémon source code from Lecture 7.
- Implement a
Menuthat 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. ThisMenushould appear right after the “Level Up” dialogue that appears at the end of a victory where the player has indeed leveled up.
Getting Started
Download the distro code for your game from cdn.cs50.net/games/2020/fall/assignments/7/assignment7.zip and unzip assignment7.zip, which should yield a directory called assignment7.
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 assignment7 (recall that the cd command can change your current directory), and run
cd assignment7
Next-Level
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.
Specification
- Implement a
Menuthat 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. ThisMenushould 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 theTakeTurnState, specifically in the:victory()function, where the actual detection of a level up takes place. Ordinarily, just aBattleMessageStategets pushed onto theStateStack, but we’ll need to go a step further and push an additionalMenuin order to accomplish what we’re after. ThisMenushould not have a cursor like the otherMenuwe’re used to seeing (in theBattleMenuState!), so you’ll need to customize theSelectionclass a little bit in order to take a boolean value to turn the cursor on or off as needed (defaulting totrueif needed to preserve the behavior of theMenuin theBattleMenuState). Note that the:levelUp()function in thePokemonclass returns all of the stat increases we need in order to display things properly, so be sure to use those returned values when creating theMenu! As long as you get a proper grasp on theSelection,Menu, andStateStackclasses, this assignment should be relatively straightforward in comparison to the complexity of this week’s code as a whole!
Errata
NONE
How to Submit
Step 1 of 2
- Download the README.md template.
- Fill out all
TODOentries in the template as appropriate, and mark a self-assessment of your design score. Then, save yourREADME.mdfile. - Go to CSCI E-23a’s Gradescope page.
- Click Project 7: Pokemon.
- Drag and drop your downloaded
README.mdfile to the area that says “Drag & Drop”. - Click Upload.
Step 2 of 2
- Download a ZIP file of your
assignment7directory, containing your implementation of this project. - Upload your submission via our Dropbox file request for this project.
- Click Add files, then Files from your computer and select your previously downloaded file.
- Click Upload.
You should see a message that your file finished uploading and that we were notified of your uploaded files. Contact your teaching fellow if not!
Your submission is not considered complete until BOTH of the above steps are complete. Omitting either step is equivalent to not submitting the project at all.
Late-submitted work will be flagged in both the Dropbox file request and on Gradescope, and any late penalty assessed will be based on whichever of the two steps was completed the latest.