What is a good way to disable movement when in dialog

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Idleman

I am working on the dialog system for my game. I want the players and enemies/NPC to stop movement when in dialog mode. Currently thinking taking a pause to the game when playing dialog, but want to get some advise if there is other better way to achieve that. Thank you.

:bust_in_silhouette: Reply From: klaas

that strongly depends on your program flow.
If you want to completly halt gametime, using pause seems to be a pretty good approach.

If animations and other npcs should continue to move and act you need a different approach,
When you want to restrict processing only on certain game elements you can ether branch your tree and set the pause mode corespondingly,
Or you can implement a master object wich calls all the objects to update and stop those objects by not calling them to update.
Or make a singleton and set a pause flag and whenever a object wants to update it first checks this flag.

… sure there are many more ways to archive this …

Thank you for your suggestions, I will first try the pause approach.

Idleman | 2020-08-28 06:06