
-----------------------------------
DeoChomp
Mon Jan 23, 2017 10:53 am

Pausing system in my game
-----------------------------------
What is it you are trying to achieve?
trying to make a pausing system in my game


What is the problem you are having?
it stops being paused after a few seconds


Describe what you have tried to solve this problem
changing the delay


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
        if a ('p') then %the if that starts the process of pausing the game
            Pause := true
        end if %the end of the if
        if Pause = true then %the if that will cause the game to stop continuing until you press the pause button again
            loop
                delay (999)
                if a ('p') then
                    Pause := false
                    exit
                end if
            end loop

Please specify what version of Turing you are using
4.1.1

-----------------------------------
Insectoid
Mon Jan 23, 2017 7:45 pm

RE:Pausing system in my game
-----------------------------------
The easiest way to pause the game is to enter a loop that exits when a key is pressed.

procedure pauseGame
    loop
        Input.KeyDown (keys)
        exit when keys ('p')
    end loop
end pauseGame

-----------------------------------
DeoChomp
Tue Jan 24, 2017 1:09 pm

Re: Pausing system in my game
-----------------------------------
it seems that when I press 'p', it does stop, but the game only continues if I hold down 'p'

-----------------------------------
Insectoid
Tue Jan 24, 2017 10:58 pm

RE:Pausing system in my game
-----------------------------------
It's probably a press-and-hold error. In the split-second that you have 'p' pressed, Input.KeyDown is called so the pause loop exits, then the program gets to your main game input section, sees that p is still pressed so enters the pause loop again. 

There are a lot of solutions to this problem, I'm sure you can come up with one.
