Class ProximityComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.ProximityComponent

public class ProximityComponent extends Component
Component class for spawning enemies when the player gets within a certain proximity. Enemies exits before this, but are disabled until the player enters their proximity.
  • Constructor Details

    • ProximityComponent

      public ProximityComponent(Entity target, double proximityRange)
      Parameters:
      target - the player entity, for detecting if it is in range
      proximityRange - the range in which the player will cause the entity to trigger the spawn animation and become enabled.
  • Method Details

    • update

      public void update()
      Updates the task's state based on the entity's position relative to the target. Triggers the "proximityTriggered" event when the entity is within the proximity range.
      Overrides:
      update in class Component