How to pause systems until input (for a roguelike)

(Rik) #1

Hi all!

I’ve started experimenting with Amethyst for a roguelike. I’ve followed the Pong tutorial which has helped me get the screen up and running and a sprite from a font spritesheet up on the screen.

What I’m struggling with is how to prevent a system from running until input is received. Eventually, I imagine I’ll need a system which does a pass for animations and another which executes only when input is received (since roguelikes tend to be turn-based). Do I need a dispatcher with systems that have it as a dependency? Or do I have an ‘ActionProcessing’ state (but then how would I keep the animation passes running)?

Thanks in advance – I’m excited to learn more about Amethyst!

(Théo Degioanni) #2

The usual practice to have “pausable” systems I’ve seen is to have a system that just starts by checking the running condition, and exits immediately otherwise.

That being said, input handling in Amethyst is event-based, so your system can just listen to the input event channel and act accordingly to the events received.

(Rik) #3

Thanks for the advice. I’ll have a play around and see what I can get working.

Perhaps I can play around with fixed updates and the frame rate to limit how often the loop registers input (currently, far too many input events are registered for each keypress so the sprite moves too fast).

(Joël Lupien) #4

We do have Pausable systems