# Check for object colliding with bounds? 

**URL:** <https://phaser.discourse.group/t/check-for-object-colliding-with-bounds/11345>\
**Category:** Phaser 3\
**Created:** [March 3, 2022, 6:15pm UTC](https://phaser.discourse.group/t/check-for-object-colliding-with-bounds/11345 "2022-03-03T18:15:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodeToad-rgb](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/codetoad-rgb/32/6287_2.png) [@CodeToad-rgb](https://phaser.discourse.group/u/CodeToad-rgb)\
**Post date:** [March 3, 2022, 6:15pm UTC](https://phaser.discourse.group/t/check-for-object-colliding-with-bounds/11345/1 "2022-03-03T18:15:03Z")

</div>

Hello, I am making a pong game and want the ball to make sounds when it bounces off of the walls. But i cannot figure out how to, any help is appreciated. Thanks!

Here is a snippet of my code:

```javascript
ball = this.physics.add.image(this.physics.world.bounds.width/2,this.physics.world.bounds.height/2,'ball').setCollideWorldBounds(true).setBounce(1,1);

```

```javascript
if( /* is colliding with bounds */ ){
   sfx_wallBounce.play();
}

```

---

<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:** [March 3, 2022, 6:15pm UTC](https://phaser.discourse.group/t/check-for-object-colliding-with-bounds/11345/2 "2022-03-03T18:15:43Z")

</div>

👋

[https://labs.phaser.io/edit.html?src=src/physics/arcade/world%20bounds%20event.js](https://labs.phaser.io/edit.html?src=src/physics/arcade/world%20bounds%20event.js)

---

<div class="post-metadata">

**Author:** ![CodeToad-rgb](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/codetoad-rgb/32/6287_2.png) [@CodeToad-rgb](https://phaser.discourse.group/u/CodeToad-rgb)\
**Post date:** [March 3, 2022, 6:54pm UTC](https://phaser.discourse.group/t/check-for-object-colliding-with-bounds/11345/3 "2022-03-03T18:54:40Z")

</div>

Is there a way to do that without making a group? My game stops when I try to replace group.getChildren() with the ball.

---

<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:** [March 4, 2022, 3:48pm UTC](https://phaser.discourse.group/t/check-for-object-colliding-with-bounds/11345/4 "2022-03-04T15:48:59Z")

</div>

Open the browser console so you can see errors.

```nohighlight
sprite.body.collideWorldBounds = true;
sprite.body.onWorldBounds = true;

```
