Last week, I focused on making a health bar for the game. It is made up of two rectangles on top of each other: the bottom one stays constant and the top one will adjust as the player’s score goes down.
I have attached the health bar to the player’s “score”. The player will have a certain amount of points at the start of the game and a point will be deducted every time the player makes an error (delivers the wrong order or takes too long to deliver the food). When the player’s score reaches zero, it will trigger a lose condition.
Although the health bar has the score equipped to it, the player currently has no way of losing points in the game play so I have no way of verifying that the health bar actually works in the way it should. I plan to make a temporary condition that will make the player lose points so that I can verify that the health bar will decrease with each point lost.
The main challenge that I encountered last week was realizing that I had no way to test my new feature. I initially assumed that it worked because the health bar appeared on my screen in the right location. It wasn’t until later in the week that I realized I didn’t actually know if the health bar would change with losing points.
I learned that when developing new features, I should come up with a test that would allow me to test all conditions, even if those conditions are not yet part of my official code. This would be the best way to make sure that all features function properly so that I can move forward confident in my code.
Leave a Reply