Pausing system in my game
Author |
Message |
DeoChomp
|
Posted: Mon Jan 23, 2017 10:53 am Post subject: 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
Description: |
the other character sprite |
|
Filesize: |
1.3 KB |
Viewed: |
3372 Time(s) |
|
Description: |
one of the character sprites |
|
Filesize: |
1.31 KB |
Viewed: |
3372 Time(s) |
|
Description: |
|
Download |
Filename: |
Catching GameDec19.t |
Filesize: |
13.21 KB |
Downloaded: |
161 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Insectoid
|
Posted: Mon Jan 23, 2017 7:45 pm Post subject: 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
|
Posted: Tue Jan 24, 2017 1:09 pm Post subject: 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
|
Posted: Tue Jan 24, 2017 10:58 pm Post subject: 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.
|
|
|
|
|
|
|
|