Jump to content

Tilemap, sprite.x+=10, overlap problem


Zenryo
 Share

Recommended Posts

Hi! I saw many people has this problem, but I can't see any working solution yet.

I have my tilemap loaded, a sprite with physical body and a overlap function.

If I am moving my sprite like sprite.body.velocity.x=100 the overlap function between the sprite and the tile works.

But if I am moving it like sprite.x+=100, then the overlap function doesn't work, but the sprite clearly overlapping the tile layer.

 

Is there any solution for this problem?

Thank you for your answers!

Link to comment
Share on other sites

Have you tried sprite.body.x += 100? The body and the sprite positions are not always aligned. You may want to try doing game.debug.body(sprite) in your render function to see if the bodies are indeed overlapping. If you need to continue to manipulate the position of the sprite without using velocity, you should set sprite.body.moves = false so that it doesn't try to interpolate your position changes.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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