Package model.entities.enemies
Class InvaderModel
java.lang.Object
model.entities.EntityModel
model.entities.enemies.EnemyModel
model.entities.enemies.InvaderModel
- All Implemented Interfaces:
Fallable
Classe che rappresenta il modello di un nemico di tipo Invader.
Estende la classe
EnemyModel
e implementa le specifiche
per il comportamento di questo tipo di nemico.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
Indica se il nemico sta attualmente sparando.Fields inherited from class model.entities.enemies.EnemyModel
active, angry, bubbleSpeed, enemyState, foodSpawned, goingUp, inBubble, inBubbleTime, pathDuration, pathTick, resetAniTick, shootingTick, shootingTimer, shot, still, stillTick, stillTimer, stuck, targetYTile, walkDir, walkSpeed
Fields inherited from class model.entities.EntityModel
airSpeed, fallingSpeed, fallSpeedAfterCollision, gravity, height, hitbox, inAir, width, x, y
-
Constructor Summary
ConstructorsConstructorDescriptionInvaderModel
(float x, float y) Costruttore per inizializzare il modello Invader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Controlla se il nemico deve sparare un laser.void
update()
Aggiorna lo stato del nemico in base al suo stato attuale.void
Aggiorna la posizione del nemico.protected void
Aggiorna il timer per lo sparo.Methods inherited from class model.entities.enemies.EnemyModel
checkBubbleDirection, checkThreeYTilesSolid, checkUpSolid, doDeathMovement, getEnemyState, getEnemyTileX, getEnemyTileY, getPlayerTileX, getPlayerTileY, getWalkDir, inBubbleMovement, isActive, isBubbleInXRange, isDeathMovement, isEnemyOnPlayerY, isFoodSpawned, isInBubble, isPlayerOnTopOfTheEnemy, isPlayerToLeftOfEnemy, isPlayerToRightOfEnemy, isResetAniTick, playerAndEnemyAreOnTheSameRow, setActive, setEnemyState, setFoodSpawned, setInBubble, setResetAniTick, startFloating, startShootingTimer, startStillTimer, updateEnemyState, updateXPos, walkWithDifferentY, walkwithSameY
Methods inherited from class model.entities.EntityModel
checkOutOfMap, fallingChecks, getHeight, getHitbox, getLevelManager, getWidth, getX, getY, initHitbox, isInAir, isInAirCheck, resetInAir, setFallingSpeed
-
Field Details
-
shooting
private boolean shootingIndica se il nemico sta attualmente sparando.
-
-
Constructor Details
-
InvaderModel
public InvaderModel(float x, float y) Costruttore per inizializzare il modello Invader.- Parameters:
x
- La coordinata X iniziale del nemico.y
- La coordinata Y iniziale del nemico.
-
-
Method Details
-
update
public void update()Aggiorna lo stato del nemico in base al suo stato attuale. Aggiorna la posizione del nemico, il timer di sparo e controlla se deve sparare.- Overrides:
update
in classEnemyModel
-
checkShooting
public void checkShooting()Controlla se il nemico deve sparare un laser. Se il nemico sta sparando, aggiunge un nuovo proiettile di tipoInvaderLaserModel
. -
updateShootingTimer
protected void updateShootingTimer()Aggiorna il timer per lo sparo. Se il timer raggiunge il limite, il nemico può sparare nuovamente. -
updatePos
public void updatePos()Aggiorna la posizione del nemico. Controlla se il nemico è in aria e gestisce la sua posizione di conseguenza.- Overrides:
updatePos
in classEnemyModel
-