Package model.entities
Class MaitaModel
java.lang.Object
model.entities.EntityModel
model.entities.EnemyModel
model.entities.MaitaModel
MaitaModel class is responsible for the maita enemy logic
-
Field Summary
Fields inherited from class model.entities.EnemyModel
active, alive, enemyState, enemyType, fallSpeed, flySpeed, goDown, goUp, isFalling, isJumping, playerTileX, playerTileY, previousWalkingDir, reachedSpawn, spawnY, startWalkingDir, updatePlayerPosMaxInterval, walkingDir, walkSpeed, xSpeed, ySpeedFields inherited from class model.entities.EntityModel
height, hitbox, immune, levelManagerModel, timer, width, x, y -
Constructor Summary
ConstructorsConstructorDescriptionMaitaModel(float x, float y, Constants.Direction startWalkingDir) Constructs a new MaitaModel with the specified position and starting direction. -
Method Summary
Modifier and TypeMethodDescriptionvoidbubbleCapture(Constants.Direction direction) Captures the Maita enemy in a bubble.protected booleancanFly()Checks if the Maita enemy can fly.Returns the type of the enemy.voidResets the state of the Maita enemy to his default state.voidupdate(PlayerModel playerModel) Updates the state of the Maita logic and behavior.Methods inherited from class model.entities.EnemyModel
calculatePlayersPos, canFall, changeWalkingDir, flipW, flipX, getEnemyState, getReachedSpawn, instantKill, isActive, isAlive, isPlayerInViewingRange, isPlayerLeftOrRight, isPlayerUpOrDown, setActive, setAlive, setEnemyState, updateSpawning, updateStateVariables, updateWalkingDirMethods inherited from class model.entities.EntityModel
conpenetrationSafeUpdateXPos, deactivate, getHitbox, getTileX, getTileY, initHitbox, initLevelManager, isImmune, updateXPos
-
Constructor Details
-
MaitaModel
Constructs a new MaitaModel with the specified position and starting direction.- Parameters:
x- the x-coordinate of the Maitay- the y-coordinate of the MaitastartWalkingDir- the initial walking direction of the Maita
-
-
Method Details
-
update
Updates the state of the Maita logic and behavior.- Specified by:
updatein classEnemyModel- 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:
resetEnemyin classEnemyModel
-
bubbleCapture
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
EnemyBubbleModelobject with inside the Maita enemy.- Overrides:
bubbleCapturein classEnemyModel- Parameters:
direction- the direction in which the bubble is moving
-
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:
getEnemyTypein classEnemyModel- Returns:
- the type of the enemy
-