Class MazeTouchAttackComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.minigames.maze.components.MazeTouchAttackComponent

public class MazeTouchAttackComponent extends Component
When this entity touches a valid enemy's hitbox, deal damage to them and apply a knockback.

Requires CombatStatsComponent, HitboxComponent on this entity.

Damage is only applied if target entity has a CombatStatsComponent. Knockback is only applied if target entity has a PhysicsComponent.

  • Constructor Details

    • MazeTouchAttackComponent

      public MazeTouchAttackComponent(short targetLayer, float knockback)
      Create a component which attacks entities on collision, with knockback.
      Parameters:
      targetLayer - The physics layer of the target's collider.
      knockback - The magnitude of the knockback applied to the entity.
  • Method Details

    • create

      public void create()
      Creates event for combat when there is a collision
      Overrides:
      create in class Component