cruzlutor

Phaser createLayer set tiles anchor

Recommended Posts

Hello,

I have an issue with the createLayer() function, My player anchor point is 0.5 but the Tiles in the layer comes with default anchor

How I can set all my layer tiles anchor to 0.5?

 

this is the current result (The big red square is the player)

Capture.PNG

 

And this is the expected

Capture2.PNG

 

thanks

Share this post


Link to post
Share on other sites

What are you trying to do? I mean, what is setting the tile anchor to (0.5) a solution for?

The tiles are not individual sprites once they're rendered on the screen, so you can't really set each anchor individually. Are you trying to reposition your player sprite to the center of the tile? Would setting it as player.x = tileX + player.width / 2; not be acceptable?

Share this post


Link to post
Share on other sites
On 9/16/2016 at 1:40 PM, drhayes said:

What are you trying to do? I mean, what is setting the tile anchor to (0.5) a solution for?

The tiles are not individual sprites once they're rendered on the screen, so you can't really set each anchor individually. Are you trying to reposition your player sprite to the center of the tile? Would setting it as player.x = tileX + player.width / 2; not be acceptable?

Yes, I think that is the best solution, thanks : )

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.

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

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.