Package view.entities
Class EnemyView
java.lang.Object
view.entities.EnemyView
- Direct Known Subclasses:
SkelMonstaView
The EnemyView class represents the view for an
EnemyModel.
It handles updating the enemy's animation and state variables.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected floatprotected intprotected final EnemyModel -
Constructor Summary
ConstructorsConstructorDescriptionEnemyView(EnemyModel enemyModel) Constructs an EnemyView with the specified EnemyModel. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the current animation index.booleanisActive()Checks if the enemy is active.voidupdate()Updates the enemy's animation and state variables.protected voidUpdates the animation tick and index based on the animation speed multiplier.protected voidUpdates the state variables for the enemy based on its current state.
-
Field Details
-
enemyModel
-
animationIndex
protected int animationIndex -
animationTick
protected int animationTick -
animationAction
protected int animationAction -
animationSpeedMultiplier
protected float animationSpeedMultiplier
-
-
Constructor Details
-
EnemyView
Constructs an EnemyView with the specified EnemyModel.- Parameters:
enemyModel- the model for the enemy entity
-
-
Method Details
-
update
public void update()Updates the enemy's animation and state variables. -
updateAnimationTick
protected void updateAnimationTick()Updates the animation tick and index based on the animation speed multiplier. -
updateStateVariables
protected void updateStateVariables()Updates the state variables for the enemy based on its current state. -
isActive
public boolean isActive()Checks if the enemy is active.- Returns:
- true if the enemy is active, false otherwise
-
getAnimationIndex
public int getAnimationIndex()Returns the current animation index.- Returns:
- the current animation index
-