From: Svjatoslav Agejenko Date: Thu, 21 Aug 2025 17:21:17 +0000 (+0300) Subject: Better code readability X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=d9f32cdf8c1d8bd04c74ea9520bb5ad6b68c5f37;p=qbasicapps.git Better code readability --- diff --git a/Games/Pomppu Paavo.bas b/Games/Pomppu Paavo.bas index bf18cf3..628fcc1 100755 --- a/Games/Pomppu Paavo.bas +++ b/Games/Pomppu Paavo.bas @@ -440,13 +440,30 @@ IF sipa = 3 THEN sipa = 1 GOTO 106 SUB DisplayGameStatistics +' +' Updates and displays the game's status information (coins collected, lives remaining) +' Handles game over condition when lives reach zero. +' +' This subroutine is called whenever the game state changes that affects statistics: +' - When a coin is collected +' - When the player loses a life +' - Periodically during gameplay + LOCATE 1, 1 -IF graphicsMode = 2 THEN GOTO 12 +IF GraphicsMode% = 2 THEN GOTO SkipTextDisplay + +' Clear previous stats display PRINT " " + +' Award extra life every 10 coins collected IF CoinsCollected% > 9 THEN CoinsCollected% = 0: LivesRemaining% = LivesRemaining% + 1 + +' Display current game statistics LOCATE 1, 1 PRINT "o "; CoinsCollected%; " Lives "; LivesRemaining% -12 + +SkipTextDisplay: +' Check if player has run out of lives IF LivesRemaining% < 0 THEN END END SUB