Key press carrying over from top down movement into battle menu

This isn’t a major issue but just something annoying that I can’t figure out without creating even more boolean values to check.

In my Top Down RPG when my player moves around it counts down a variable which triggers battle when it reaches zero. The same keys are used in the battle menu to select between attacking and running away. (left and right arrow) If i’m moving right when battle starts then my menu selection moves to the right which selects running away, but I don’t want that to happen unless they press right after the battle starts.

It’s currently on key released, but that just delays the inevitable.

The battle is meant to be quick, basically I want experience of a monster popping up and you can just spam enter to attack and kill, then move on. This keeps making me accidently run away.

Game is here: (You’ll need to leave the village before a battle is triggered)

Hi, just an idea: you could deactivate your controls - it seems you are using the top down movement behavior - for a short time when you get into the battle. There is a De/activate-action for behaviors. For activating it again you could use a timer. The wait action may work as well.

You could go with boolean variable
When battle starts you hide some layer or object
And when battle ends you hide it

Now all you need to do is to add condition to event which counts number of moves
Object/layer is not visible

Meaning when battle starts it will stop counting

I think I will just add a small 1 or 2 sec transition animation into a battle, the player should instinctively remove their finger off the keyboard, if they don’t then they don’t…