# Target what is overlapping in group

**URL:** <https://phaser.discourse.group/t/target-what-is-overlapping-in-group/1733>\
**Category:** Phaser 3\
**Created:** [March 19, 2019, 12:27am UTC](https://phaser.discourse.group/t/target-what-is-overlapping-in-group/1733 "2019-03-19T00:27:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lindsey\_Hensley](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/lindsey_hensley/32/912_2.png) [@Lindsey\_Hensley](https://phaser.discourse.group/u/Lindsey_Hensley)\
**Post date:** [March 19, 2019, 12:27am UTC](https://phaser.discourse.group/t/target-what-is-overlapping-in-group/1733/1 "2019-03-19T00:27:36Z")

</div>

Does Phaser have a built in way for when a member of a group is overlapping with the player, that it can tell me specifically which child of the group is being overlapped? I have two objects, slime & slime2. I want to be able to differentiate which object I am overlapping with, and then execute the code within the brackets targeted at that object.

```
if(this.physics.world.overlap(this.player, this.slimeGroup, null, null, this))
        {
            this.slime.tween.pause();
            this.slime.anims.stop();
        }else{
            this.slime.tween.resume();
        }
```

---

<div class="post-metadata">

**Author:** ![jest](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jest/32/409_2.png) [@jest](https://phaser.discourse.group/u/jest)\
**Post date:** [March 19, 2019, 12:57am UTC](https://phaser.discourse.group/t/target-what-is-overlapping-in-group/1733/2 "2019-03-19T00:57:52Z")

</div>

One of the ways you can differentiate is to assign the slimes an ID and then if(slime.id === idyouwant)

```javascript

this.physics.world.overlap(this.player, this.slimeGroup, (player, slime)=>{
         if(slime.id === this.slime.id){
             this.slime.tween.pause();
             this.slime.anims.stop();
       } else {
            this.slime.tween.resume();
       }
})

```

I notice you ask quite the lot of questions, join us here for instant chat!: [https://discord.gg/phaser](https://discord.gg/phaser)

---

<div class="post-metadata">

**Author:** ![Lindsey\_Hensley](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/lindsey_hensley/32/912_2.png) [@Lindsey\_Hensley](https://phaser.discourse.group/u/Lindsey_Hensley)\
**Post date:** [March 19, 2019, 3:19am UTC](https://phaser.discourse.group/t/target-what-is-overlapping-in-group/1733/3 "2019-03-19T03:19:47Z")

</div>

Thanks for the reply jest! I ended up just putting the following inside of the slime class update method:

```
if(scene.physics.world.overlap(scene.player, this, null, null, scene))
        {
            this.tween.pause();
            this.anims.stop();
        }else{
            this.tween.resume();
        }

```

And thank you for the link! I will most definitely join!
