https://www.youtube.com/watch?v=OUDNncXB950&list=PLhQjrBD2T383Vx9-4vJYFsJbvZ_D17Qzh&index=8
- Read and understand all of the Pokémon source code from Lecture 7.
- 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. ThisMenu
should appear right after the "Level Up" dialogue that appears at the end of a victory where the player has indeed leveled up.
Download the distro code for your first game from https://cdn.cs50.net/games/2018/spring/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
Welcome to your seventh 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. ThisMenu
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 theTakeTurnState
, specifically in the:victory()
function, where the actual detection of a level up takes place. Ordinarily, just aBattleMessageState
gets pushed onto theStateStack
, but we'll need to go a step further and push an additionalMenu
in order to accomplish what we're after. ThisMenu
should not have a cursor like the otherMenu
we're used to seeing (in theBattleMenuState
!), so you'll need to customize theSelection
class a little bit in order to take a boolean value to turn the cursor on or off as needed (defaulting totrue
if needed to preserve the behavior of theMenu
in theBattleMenuState
). Note that the:levelUp()
function in thePokemon
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 theMenu
! As long as you get a proper grasp on theSelection
,Menu
, andStateStack
classes, this assignment should be relatively straightforward in comparison to the complexity of this week's code as a whole!
Coming Soon