Jump to content

How to interact with drawn polygons (via pointer/touch input)?


gabehollombe
 Share

Recommended Posts

Hey folks!

 

I'm working on creating a game that uses a hexagon grid as its board.  I'd like to let players click/tap on a hexagon cell to select it.  I can use drawPolygon() from a Geometry instance to get the hexagons drawn, but drawPolygon doesn't return anything I can attach an input handler event to?

 

I know I can always translate pixel values into hexagons with an algorithm, but is there an easier way to detect which polygon I've clicked/touched?

Link to comment
Share on other sites

Hey folks!

 

I'm working on creating a game that uses a hexagon grid as its board.  I'd like to let players click/tap on a hexagon cell to select it.  I can use drawPolygon() from a Geometry instance to get the hexagons drawn, but drawPolygon doesn't return anything I can attach an input handler event to?

 

I know I can always translate pixel values into hexagons with an algorithm, but is there an easier way to detect which polygon I've clicked/touched?

 

It looks like PIXI has support for clicking on DisplayObjects, which I'm guessing Graphics is an instance of...  Has anyone figured out how to use a PIXI InteractionManager with a Phaser Graphics object instance to handle clicks?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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