Sign in to follow this  

Tilemap, sprite.x+=10, overlap problem

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!

Share this post

Link to post
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.

Share this post

Link to post
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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.