I am trying to put in a game where the user can play with the computer similar to snake and ladders. When the user hits a danger block, an alert is shown that the user has to spawn again and used the “wasconfirmed” to confirm if the button is pressed. The code automatically plays for the computer.
The issue I am facing is when the alert is shown, before the confirmation button is pressed, the computer starts playing (ie remaining code is getting executed when the alert screen is shown). Is there a way to prevent it?
Code snippet is shown. So if the player is poisoned, the alert will show. But before confirmation the next set of code is being run.