Package model.projectiles
Class MaitaFireProjectileModel
java.lang.Object
model.entities.EntityModel
model.projectiles.ProjectileModel
model.projectiles.MaitaFireProjectileModel
Represents the logic of a Maita fire projectile in the game.
-
Field Summary
Fields inherited from class model.projectiles.ProjectileModel
direction, state, timer, typeFields inherited from class model.entities.EntityModel
active, height, hitbox, immune, levelManagerModel, width, x, y -
Constructor Summary
ConstructorsConstructorDescriptionMaitaFireProjectileModel(float x, float y, Constants.Direction direction) Constructs a MaitaFireProjectileModel with the specified position and direction. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckEnemyHit(EnemyModel enemyModel, PlayerModel playerModel) Checks if the projectile hits an enemy.voidcheckPlayerHit(PlayerModel playerModel) Checks if the projectile hits the player.protected voidUpdates the position of the projectile.Methods inherited from class model.projectiles.ProjectileModel
getDirection, getState, getType, update, updateTimerMethods inherited from class model.entities.EntityModel
conpenetrationSafeUpdateXPos, deactivate, getHitbox, getTileX, getTileY, initHitbox, initLevelManager, isActive, isImmune, setActive, updateXPos
-
Constructor Details
-
MaitaFireProjectileModel
Constructs a MaitaFireProjectileModel with the specified position and direction.- Parameters:
x- the x-coordinate of the projectiley- the y-coordinate of the projectiledirection- the direction of the projectile
-
-
Method Details
-
updatePos
protected void updatePos()Updates the position of the projectile.Moves the projectile left or right based on its direction and changes its state to IMPACT if collide with an obstacle.
- Specified by:
updatePosin classProjectileModel
-
checkEnemyHit
Checks if the projectile hits an enemy.This method is not used as Maita fire projectiles cannot hit enemies.
- Specified by:
checkEnemyHitin classProjectileModel- Parameters:
enemyModel- the enemy model to check againstplayerModel- the player model to check against
-
checkPlayerHit
Checks if the projectile hits the player.If the projectile hits an active and non-immune player, it kills the player and changes its state to IMPACT.
- Specified by:
checkPlayerHitin classProjectileModel- Parameters:
playerModel- the player model to check against
-