Time for action – updating and displaying ScoreZooms
Add a
Queue
object to the Game1 class to hold activeScoreZooms
:Queue<ScoreZoom> ScoreZooms = new Queue<ScoreZoom>();
Add a new helper method to the Game1 class to update the
ScoreZooms
queue:private void UpdateScoreZooms() { int dequeueCounter = 0; foreach (ScoreZoom zoom in ScoreZooms) { zoom.Update(); if (zoom.IsCompleted) dequeueCounter++; } for (int d = 0; d < dequeueCounter; d++) ScoreZooms.Dequeue(); }
In the
Update()
method, inside the case section forGameState.Playing
, add the call to update any active ScoreZooms. This can be placed right before the case'sbreak;
statement:UpdateScoreZooms();
Add the following to the
CheckScoringChain()
method to create aScoreZoom
when the player scores. Add this right after theplayerScore
is increased:ScoreZooms.Enqueue(new ScoreZoom("+" + DetermineScore(WaterChain.Count).ToString(), new Color(1.0f, 0.0f, 0.0f, 0.4f...