replaced final score with net worth instead of out of 100

closes #5
This commit is contained in:
Rudis Muiznieks 2022-06-21 20:37:52 -05:00
parent c0937fed08
commit cd55de5ce0
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
1 changed files with 11 additions and 9 deletions

View File

@ -353,17 +353,19 @@ void loop() {
break; break;
case STATE_GAME_OVER: { case STATE_GAME_OVER: {
int score = floor(sqrt((pSavingsAmount + pMoney - pLoanAmount) / 31.5)); dialog[0] = "Game over! Score:";
if (score > 100) score = 100;
dialog[0] = "";
dialog[1] = " Game over!";
dialog[2] = " Your score: ";
dialog[2] += String(score);
dialog[3] = " out of 100.";
dialogSmall = false; dialogSmall = false;
dialogLength = 4; dialogLength = 1;
sPreviousGameState = STATE_TITLE; sPreviousGameState = STATE_TITLE;
pMoney += pSavingsAmount - pLoanAmount;
for (int i = 0; i < 6; i++) {
pMoney += pInventory[i] * sDrugPrices[i];
}
if (pMoney < 0) {
pMoney = 0;
}
drawDialog(); drawDialog();
drawMoney(10, 20, pMoney);
break; break;
} }