Class BubbleGenerator

java.lang.Object
model.bubbles.specialBubbles.BubbleGenerator

public class BubbleGenerator extends Object
Generates special bubbles at specified intervals.

This class is responsible for generating special bubbles (e.g., water bubbles, lightning bubbles) at regular intervals. It uses a timer to control the spawn rate and determines the position and direction of the bubbles based on the generator type and position.

  • Constructor Details

  • Method Details

    • update

      public void update()
      Updates the state of the bubble generator.

      This method updates the timers and checks if a new bubble should be spawned.

    • updateTimers

      public void updateTimers()
      Updates the spawn timer.

      This method decreases the spawn timer based on the elapsed time.

    • checkBubbleSpawn

      public void checkBubbleSpawn()
      Checks if a new bubble should be spawned.

      If the spawn timer has elapsed and the number of active special bubbles is below the maximum limit, a new bubble is spawned.

    • spawnBubble

      public void spawnBubble()
      Spawns a new bubble.

      This method calculates the position and direction of the new bubble and adds it to the special bubble manager.