I'm building a GameEngine using Ashley and some how I can't figure out how.

I through I could use something like this. Or use the Signal/Listener from Ashley. But how to Implement a interactive HUD? This is my current idea:

I have a System that only polls for inputs. If it detects an Input it would be a MouseClick so the PollySystem is sending out a MouseClickEvent witch the Coords. And a HUDClickedSystem will catch this event and checks if the click was inside a HUD Boundary and will Tag it with a clickedCompoment or not. A Third system will look out for all entities with a clickedComponent and will react something like Respawn button clicked -> Respawn, Pause button clicked -> Pause etc.

This is a mix from the ideas here and here

I would love to have something like the Command pattern / Intent System because I think it easy and straight forward but I can't figure out how to handle more than a flag ( Key pressed / Mouse pressed ). But for this I need to know where the Mouse is pressed.

  • 2
    \$\begingroup\$ "Should it"? It's your game. You get to decide how it "should" be structured. If the scheme you've described works for your needs, run with it. If it has a specific problem you need help solving, describe that problem and we'll help you solve it. \$\endgroup\$
    – DMGregory
    Jun 7, 2020 at 20:51
  • \$\begingroup\$ I don't want to run into problems which I could avoided easily in the early development. Could you say wich is the common approach for this problem? I'm sure there is at least one more game outside that has this problem and a solution ;) I'm very new to the game and I may be overthinking much but unfortunately for me there is a lot of documents around with genial concepts but they poorly described a implementation or solutions for problems like this. \$\endgroup\$
    – Meeresgott
    Jun 7, 2020 at 22:12
  • \$\begingroup\$ Don't worry, there will plenty of fun problems to solve no matter which way you go. This is game development. It's problems all the way down. Just keep going, and let us know when you hit a problem you can't solve alone, and we'll help you solve it. \$\endgroup\$
    – DMGregory
    Jun 7, 2020 at 22:14


You must log in to answer this question.

Browse other questions tagged .