Jump to content

How to get sprite(player) position in terms of coordinates


Recommended Posts

Could you please elaborate a little more? Any more information or just make your first post make more sense please lol

What I kind of got from that is that you have a player and a tiled map ABOVE the player, and you want the players tiled coordinates so you can remove the tile ABOVE the player (so you can see the player). I might be wrong to what you mean bc idrk what you were trying to say in the post above. But, if that is what you were trying to say, there is no need to do that since you can just move the player sprite to show up above the tiled layer. If you are having the problem i described, you most likely defiened the tiled layer after you defined the sprite?

If that wasnt your problem and want to just find out what tiled coordinate the player is at, you can do something like this:

tiledX = Math.round(player.x/(the width of a tile in your tiled map));

tiledY = Math.round(player.y/(the height of a tile in your tiled map));

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...