Class MaitaModel


public class MaitaModel extends EnemyModel
MaitaModel class is responsible for the maita enemy logic
  • Constructor Details

    • MaitaModel

      public MaitaModel(float x, float y, Constants.Direction startWalkingDir)
      Constructs a new MaitaModel with the specified position and starting direction.
      Parameters:
      x - the x-coordinate of the Maita
      y - the y-coordinate of the Maita
      startWalkingDir - the initial walking direction of the Maita
  • Method Details

    • update

      public void update(PlayerModel playerModel)
      Updates the state of the Maita logic and behavior.
      Specified by:
      update in class EnemyModel
      Parameters:
      playerModel - the player model used to update the Maita's behavior
    • canFly

      protected boolean canFly()
      Checks if the Maita enemy can fly.

      This method checks if there is a solid tile to fly on, and if there is, it checks if there is an empty tile on top. It determines if the Maita can fly by checking for solid tiles above the enemy within a certain range.

      Returns:
      true if the Maita can fly, false otherwise
    • resetEnemy

      public void resetEnemy()
      Resets the state of the Maita enemy to his default state.
      Overrides:
      resetEnemy in class EnemyModel
    • bubbleCapture

      public void bubbleCapture(Constants.Direction direction)
      Captures the Maita enemy in a bubble.

      This method is called when the Maita enemy is captured in a bubble. It resets various state variables of the Maita enemy, including flags for falling, jumping, and flying.

      It also calls the superclass's bubbleCapture method, that created a EnemyBubbleModel object with inside the Maita enemy.

      Overrides:
      bubbleCapture in class EnemyModel
      Parameters:
      direction - the direction in which the bubble is moving
    • getEnemyType

      public Constants.EnemyConstants.EnemyType getEnemyType()
      Returns the type of the enemy.

      This method overrides the getEnemyType method from the superclass to return the specific type of the enemy, which is MAITA.

      Specified by:
      getEnemyType in class EnemyModel
      Returns:
      the type of the enemy