Super short conclusion of my Pygame junior learner experience. Please do not expect a heartfelt speech in my content.
This last section of this starter Pygame series will focus on fixing bugs from the previous Pygame topics, including personal alterations to the source code introduced by the creator of the series.
The last section contained a bug where the player's altitude will permanently decrease if they were hit while jumping.
This bug originates from neglecting the jumping variables' states since our system resets player height via deductive formula. To rectify this, we simply reset isJumping and jumpCount in hit(), effectively making the system 'forget' the player is jumping while completing the action while the screen is frozen.
The result is a clean resetting of the player's position, regardless of their last y-position (height).
The tutorial series' scoreboard function was hard-coded into the runtime loop. This method has made backtracking and proof-reading the overall code more taxing and demanding of my limited perception.
To make it more customizable and applicable to non-player entities, I decided to stuff all scoring codes into an external, fetchable class.
This way, we need only specify the scoreboard class in the redrawGameWindow() function to get it running. It is also possible to apply the same class to separate players at once, but that is a topic for another time.