Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Pausing system in my game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DeoChomp




PostPosted: 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



doop.jpg
 Description:
the other character sprite
 Filesize:  1.3 KB
 Viewed:  3041 Time(s)

doop.jpg



boop.jpg
 Description:
one of the character sprites
 Filesize:  1.31 KB
 Viewed:  3041 Time(s)

boop.jpg



Catching GameDec19.t
 Description:
the program

Download
 Filename:  Catching GameDec19.t
 Filesize:  13.21 KB
 Downloaded:  150 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: 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




PostPosted: 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




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: