Class ProjectileModel

java.lang.Object
model.entities.EntityModel
model.projectiles.ProjectileModel
Direct Known Subclasses:
LightingProjectileModel, MaitaFireProjectileModel, PlayerBubbleProjectileModel

public abstract class ProjectileModel extends EntityModel
Abstract class representing the model of projectile objects in the game.
  • Field Details

  • Constructor Details

    • ProjectileModel

      public ProjectileModel(float x, float y, Constants.Direction direction, Constants.Projectiles.ProjectileType type)
      Constructs a ProjectileModel with the specified position, direction, and type.
      Parameters:
      x - the x-coordinate of the projectile
      y - the y-coordinate of the projectile
      direction - the direction of the projectile
      type - the type of the projectile
  • Method Details

    • update

      public void update()
      Updates the position and internal timers of the projectile.
    • updatePos

      protected abstract void updatePos()
      Updates the position of the projectile.
    • checkEnemyHit

      protected abstract void checkEnemyHit(EnemyModel enemyModel, PlayerModel playerModel)
      Checks if the projectile hits an enemy.
      Parameters:
      enemyModel - the enemy model to check against
      playerModel - the player model to check against
    • checkPlayerHit

      protected abstract void checkPlayerHit(PlayerModel playerModel)
      Checks if the projectile hits the player.
      Parameters:
      playerModel - the player model to check against
    • updateTimer

      protected void updateTimer()
      Updates the impact timer and deactivates the projectile if the timer reaches zero.
    • getState

      Returns the current state of the projectile.
      Returns:
      the current state of the projectile
    • getType

      Returns the type of the projectile.
      Returns:
      the type of the projectile
    • getDirection

      public Constants.Direction getDirection()
      Returns the direction of the projectile.
      Returns:
      the direction of the projectile