User-Interaction with multiple overlapping gamestates

Hi everybody,

I am not sure if this is the right place. So if it is wrong please move this thread.


I want tu use multiple Gamestates that are overlapping themselves. If the user clicks on a button within the Hud and a Hexagon is also within the mouseray both Gamestates would react. But I only want that if a click happens within the HUD ONLY the HUD reacts.

  • a HUD with buttons (open Information windows)
  • a Map which is clickable (selecting Hexagons)

  • Should I use a global Handler and pass the instance to all gamestates ? (But how do i determine which gamestate reacted?)
  • Should I use several Handlers ? (But how can I select that first the Hudscreen is updated and then the Mapscreen ?)



I would maintain a special GameState that is specifically for controls.  You might also consider looking at the GameControls system in jME as it is designed to help with that sort of thing as well.

As for now I will use the specific gamestate. That works fine. Thx for your idea!