Bust Condition Handled
Added code to detect if an LED has busted, which makes the game transition to the GAMEOVER state. Added a GameOverScreen class to handle the display of the game over state. Need to determine if I should give a warning to the player if the wire connected to the light is higher than its bust value, and allow the player to put a resistor there before the light has filled to avoid losing the stage. Currently, once the light starts filling it is locked to that value, which doesn’t give the player a chance to fix their mistake.
Will add a meter to the lower right corner to display the Elex flow value of the currently selected cell.
Time Variables Added
I was able to get the current game time using the TotalGameTime.TotalMilliseconds property of the GameTime object that is passed to the update method. However, I had to update all the update methods of all classes that extend Screen to accept GameTime as a parameter. Created three new instance variables to the GameLevel class for holding the level start time, the current time, and the end time. The end time is now displayed on the game win screen.
Created LevelDefinition class to hold the definition of the layout of each level along with the requirements for each piece/time/luminosity rank. Created arrays of size 3 for holding each grade threshold. Index 0 is for the S rank, index 1 is for A rank, 2 is for B rank, and all greater values are assigned C rank.
Fixed the getPieceCount method that returns the Pieces Used end level statistic to not count the LED and battery pieces, but only wires and resistors.
Added methods to the LevelDefinition class to take a piece count, luminosity value, or time and it will return the grade rank for each of those values. The grade ranks are now displayed on the game win screen. Using yellow for S, blue for A, green for B, and red for C.
Just thought I would reiterate the fact that I’m trying to make a fun game that is as scientifically accurate as possible, instead of trying to make a scientific simulation as fun as possible.