mouse position to isometric tile including height

前端 未结 7 938
太阳男子
太阳男子 2021-01-30 22:11

Struggeling translating the position of the mouse to the location of the tiles in my grid. When it\'s all flat, the math looks like this:

this.position.x = Math.         


        
7条回答
  •  遥遥无期
    2021-01-30 22:37

    I had same situation on a game. first I tried with mathematics, but when I found that the clients wants to change the map type every day, I changed the solution with some graphical solution and pass it to the designer of the team. I captured the mouse position by listening the SVG elements click.

    the main graphic directly used to capture and translate the mouse position to my required pixel.

    https://blog.lavrton.com/hit-region-detection-for-html5-canvas-and-how-to-listen-to-click-events-on-canvas-shapes-815034d7e9f8 https://code.sololearn.com/Wq2bwzSxSnjl/#html

提交回复
热议问题