How do I update the player's X/Y position with grid movement enabled?

0 favourites
  • 3 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • I've noticed a funny quirk of the grid-based movement system.

    To move my player between levels I find the X/Y position of the origin of the sprite where I want to move the player to (warpTo sprite) and then set the player's X/Y to inherit these values. The two sprites are the same size (16x16) and have their origin point in the same position (0,16) so the player should end up in that exact location.

    What ends up happening is the player appears a few pixels below this point. Sometimes even on partial pixels (y:26.777)

    If I disable grid-based movement this doesn't happen.

    If I increase the player's grid-based movement speed, the issue worsens (they end up 10+ pixels past the point I sent them to)

    This made me think maybe the player was still moving after being sent to the new position but even when I wait for the player to stop moving (not isMoving) before sending them, I get the same issue.

    Any thoughts on what might be happening?

    Thanks!

  • Generally avoid mixing movement behaviors with each other or direct movement.

    You can simply disable and re-enable the behavior if you need to do something like teleport.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Alternatively You can create grid movement via even sheet:

    dropbox.com/login

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)