Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layer.getTileCorners not working for hex tilemaps. #6913

Closed
jummy123 opened this issue Oct 1, 2024 · 1 comment
Closed

layer.getTileCorners not working for hex tilemaps. #6913

jummy123 opened this issue Oct 1, 2024 · 1 comment

Comments

@jummy123
Copy link

jummy123 commented Oct 1, 2024

Version

  • Phaser Version: Phaser v3.85.2 (WebGL | Web Audio)
  • Operating system: linux
  • Browser: only tested with firefox

I am using the phaser-react-typescript-template

Description

I am trying to user the functionality getTileCorners when using a hexagonal tilemap. The tilemap json file is created using Tiled editor and I am trying to replicate this example https://labs.phaser.io/edit.html?src=src/bugs\0000%20hex%20corners.js.

The error I am getting is the following.

TypeError: this is undefined
    HexagonalTileToWorldXY phaser.js:228061
    HexagonalGetTileCorners phaser.js:227960
    getTileCorners phaser.js:223516
    getTileCorners phaser.js:225174

Example Test Code

This is my code, for information the tilemap is rendering correctly

    create ()
    {
        const map = this.add.tilemap('map');
        const tileset = map.addTilesetImage('tileset', 'tiles');
        const layer = map.createLayer('ground', tileset);
        console.log(layer.getTileCorners(10, 10))

Additional Information

I did fix the problem on my local install by changing references to this to layer in the following function HexagonalTileToWorldXY.

If this is confirmed to be a bug (and not a misconfiguration on my end) I'd be happy to open a PR with the fix.

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants