# Problems with floor physics

**URL:** <https://phaser.discourse.group/t/problems-with-floor-physics/2824>\
**Category:** Phaser 3\
**Created:** [June 19, 2019, 6:23am UTC](https://phaser.discourse.group/t/problems-with-floor-physics/2824 "2019-06-19T06:23:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alessandropolverino](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@alessandropolverino](https://phaser.discourse.group/u/alessandropolverino)\
**Post date:** [June 19, 2019, 6:23am UTC](https://phaser.discourse.group/t/problems-with-floor-physics/2824/1 "2019-06-19T06:23:35Z")

</div>

Newbie alert!  
I’m writing because I’m having a lot of issues creating the map of my game. I have a map made of two png layers, one for the bg and one for the floor.  
I’ve loaded the floor png as an image and then I’ve added it to the game as tileSprite

```javascript
this.floor = this.add.tileSprite(0, 508, 764, 65, 'floor').setOrigin(1);

```

then I’ve created the collider with the player

```javascript
    this.physics.add.collider(this.floor, this.player);

```

I wanted to use the onFloor() method to check if my player was on the floor, but even if it is on the ground the output is false

---

<div class="post-metadata">

**Author:** ![jcyuan](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jcyuan](https://phaser.discourse.group/u/jcyuan)\
**Post date:** [June 19, 2019, 9:48am UTC](https://phaser.discourse.group/t/problems-with-floor-physics/2824/2 "2019-06-19T09:48:16Z")

</div>

this is already in the examples? have you checked it already?

---

<div class="post-metadata">

**Author:** ![retroVX](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/retrovx/32/1491_2.png) [@retroVX](https://phaser.discourse.group/u/retroVX)\
**Post date:** [June 19, 2019, 2:14pm UTC](https://phaser.discourse.group/t/problems-with-floor-physics/2824/3 "2019-06-19T14:14:47Z")

</div>

Hi,

The reason it’s not working is due to the tilesprite not having physics attached.

I’m not sure if this will work but I found some information from this link:

> **[Is it possible to add tileSprite to physics?](http://www.html5gamedevs.com/topic/36754-is-it-possible-to-add-tilesprite-to-physics/)**
>
> I was noodling around and trying to create groups of game objects that had 3 sprites that were cropped from one image. Similar to a 3-panel round cornered web button. The reason for this structure is I need variable width with the outer left and...

The suggested method:  
`this.floor = this.add.tileSprite(0, 508, 764, 65, 'floor').setOrigin(1);`  
`this.physics.add.existing(this.floor);`

Hopefully that should work 🙂

---

<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:** [June 19, 2019, 3:41pm UTC](https://phaser.discourse.group/t/problems-with-floor-physics/2824/4 "2019-06-19T15:41:50Z")

</div>

[https://labs.phaser.io/view.html?src=src\physics\arcade\add%20body%20to%20tilesprite.js](https://labs.phaser.io/view.html?src=src%5Cphysics%5Carcade%5Cadd%20body%20to%20tilesprite.js)
