Class CollisionDetector
java.lang.Object
fr.paris.saclay.sidescroller.controllers.CollisionDetector
Handles entities' collisions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkCollision
(Player player, Entity entity, boolean isAttackHitbox) Checks collisions between the player and the enemies.
-
Constructor Details
-
CollisionDetector
public CollisionDetector()
-
-
Method Details
-
checkCollision
Checks collisions between the player and the enemies. If player is attacking, it checks if the attack's hitbox intersects the enemy's hitbox; valid also for the block's hitbox.- Parameters:
player
- Player entity.entity
- enemy entity.isAttackHitbox
- identifies if it is checking attack hitbox.- Returns:
- true if entity is colliding, false otherwise.
-