# Is there an way to detect an overlap within an update loop if statement?

**URL:** <https://phaser.discourse.group/t/is-there-an-way-to-detect-an-overlap-within-an-update-loop-if-statement/15463>\
**Category:** Phaser 3\
**Created:** [August 17, 2025, 10:58pm UTC](https://phaser.discourse.group/t/is-there-an-way-to-detect-an-overlap-within-an-update-loop-if-statement/15463 "2025-08-17T22:58:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bread](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/bread/32/9050_2.png) [@bread](https://phaser.discourse.group/u/bread)\
**Post date:** [August 17, 2025, 10:58pm UTC](https://phaser.discourse.group/t/is-there-an-way-to-detect-an-overlap-within-an-update-loop-if-statement/15463/1 "2025-08-17T22:58:44Z")

</div>

Is there an way to detect an overlap within an update loop if statement?  
My specific scenario is between a player sprite, and a group of sprites ( enemies).  
Any answers are great!

🍞

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [August 18, 2025, 3:34pm UTC](https://phaser.discourse.group/t/is-there-an-way-to-detect-an-overlap-within-an-update-loop-if-statement/15463/2 "2025-08-18T15:34:41Z")

</div>

```javascript
if (this.physics.overlap(sprite, group)) {
  // …
}

```

or

```javascript
this.physics.overlap(sprite, group, function (_sprite, spriteInGroup)) {
  // …
});

```

🥐
