Enhancing our math game
We are going to add some features to our math game using what we have just learned about methods and loops.
As usual, the code is available for copying in the Chapter4
folder of the code download. The project is in the MathGameChapter4
subfolder and encompasses all the remaining phases of improvement covered in this chapter, including enhancing the UI, amending our game activity, setQuestion
, updateScoreAndLevel
, isCorrect
, and calling our new methods.
We will make the game change the question after each time we attempt the answer.
We will also add difficulty levels to questions and random questions but within a range appropriate for that difficulty level.
We will show and update our score. The score goes up faster depending on the difficulty level of the question answered correctly.
If the player gets a question wrong, the difficulty goes back to the easiest level and the score to zero.
Enhancing the UI
Let's get on with modifying our math game UI to incorporate our new...