Jump to content

Phaser createLayer set tiles anchor


cruzlutor
 Share

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

Link to comment
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?

Link to comment
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 : )

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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