Class WaterFlowModel

java.lang.Object
model.entities.EntityModel
model.bubbles.specialBubbles.WaterFlowModel

public class WaterFlowModel extends EntityModel
Represents a water flow generated by a water bubble when it pops.

This class extends the EntityModel and provides specific behavior for water flows. Water flows move in a random horizontal direction and interact with players, enemies, bubbles, and items.

  • Constructor Details

    • WaterFlowModel

      public WaterFlowModel(float x, float y)
      Constructs a new WaterFlowModel.
      Parameters:
      x - the starting x coordinate
      y - the starting y coordinate
  • Method Details

    • update

      public void update()
      Updates the state and position of the water flow.

      This method handles the first update, updates timers, moves the water flow, updates water drop positions, and checks if the water flow is out of the screen.

    • timersUpdate

      public void timersUpdate()
      Updates the timers for the water flow.

      This method decreases the water drop timer based on the elapsed time. It also updates the transparency timer to toggle the transparency state of the water flow at specified intervals.

    • updateCollisions

      public void updateCollisions(PlayerModel playerModel)
      Updates the collisions for the water flow.

      This method checks for collisions with the player, enemies. If the water flow captures the player, it also checks for collisions with bubbles and items.

      Parameters:
      playerModel - the player model to check for collisions with the player
    • flipX

      public int flipX()
      Calculates the x-coordinate flip value for rendering the water flow.

      This method determines the direction in which the water flow should be flipped based on its current direction. If the direction is UP or DOWN, it uses the previous direction. If the direction is RIGHT, it returns 0; otherwise, it returns the width of the water flow.

      Returns:
      the x-coordinate flip value for rendering
    • flipW

      public int flipW()
      Calculates the width flip value for rendering the water flow.

      This method determines the direction in which the water flow should be flipped based on its current direction. If the direction is UP or DOWN, it uses the previous direction. If the direction is RIGHT, it returns 1; otherwise, it returns -1.

      Returns:
      the width flip value for rendering
    • getIsTransparent

      public boolean getIsTransparent()
    • getLastPositions

      public List<Point> getLastPositions()
    • isPlayerCaptured

      public boolean isPlayerCaptured()
    • isPlaySoundActive

      public boolean isPlaySoundActive()