Task 5.2: Check whether two hitboxes are colliding
- Create a property called
interact_foods(self, food)
in the food class - Use the colliderect to check whether the rectangular hitboxes are colliding
- If they are colliding, remove food from the active_foods list
💡 Hint
- Check if the player hitbox is colliding with the food hitbox:
collision = self.hitbox.colliderect(food.hitbox)
- The collision variable is True if the hitboxes are colliding and False if not