Jump to content

Issue with .onFloor() and tiles causing failed collision?


Recommended Posts

I've created this piece of input in my current platformer:

if(this.cursor.down.isDown || this.wasd.down.isDown){                if (this.player.body.onFloor() == false && this.slamValue == 0) {                      this.player.body.velocity.y = 1000;                      this.slamSound.play();                      this.slamValue = 1;                }            }

Which causes the player to move downward quickly. 


I was previously using this.player.touching.down on non-tilemaps but switched to using Tiled because it's easier to make levels. Unfortunately, sometimes when issuing this downward slam the player will not collide with the tiles and move through floors. Note that this does not happen every time you slam down.


Is there a known issue with this or something that I'm perhaps doing wrong?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...