Pause

Blitz3D Forums/Blitz3D Programming/Pause

Mortiis(Posted 2007) [#1]
Anyone have proper solutions for pausing a 3D game?

global key = 0
global pausekey = 25

while not key = pausekey
    key = waitkey()
wend


like solutions doesn't work for me.Especially after loading, when level starts, everything appears to be started moving, AI attacking etc. until it starts to render something to the screen.So I want to add a "press a key to start" on each level.Pausing during the game is needed also.

I hope you will understand what I mean.Thanks.

(code above is just an example, I don't know even if it's working lol)


b32(Posted 2007) [#2]
I don't completely get what you mean. Maybe you could pause everything that moves in the game ? Sort of like this:
Repeat

   If not keydown(pausekey) Then
     UpdateWorld
     UpdateGame   ;AI etc.
     UpdatePlayer ;controls etc.
   End If

   RenderWorld
   Flip

Forever



Eviltoes(Posted 2007) [#3]
.mainloop
while exit=false and pause=false
if keyhit(1) then exit=true
if keyhit(57) then pause=true
wend

repeat
if keyhit(57) then pause=false
until pause=false

goto mainloop


this might work


blade007(Posted 2007) [#4]
try this
pausekey=25

while not keydown(1)
  print"hi"
   if keyhit(pausekey)
     flushkeys
      repeat
      until keyhit(pausekey)
   endif
  print"bye"
wend



Ben(t)(Posted 2007) [#5]
I have something like this


if keyhit(57) then gotosub pause
renderworld
flip
wend
end

pause
while not keyhit(57)

renderworld
flip
wend
return


Yahfree(Posted 2007) [#6]
Or like this:


PauseMode=False

While Not Keyhit(1)



If PauseMode=False
;Do everything
If KeyHit(PauseButton) PauseMode=True

Else

;Pause Screen
If keyhit(PauseButton) PauseMode=false

end if

wend




Jerome Squalor(Posted 2007) [#7]
 if keyhit(pausekey)

while not keyhit(pausekey)


wend

endif



Yo! Wazzup?(Posted 2007) [#8]
wow, just use ONE of these, okay Mortiis?


Mortiis(Posted 2007) [#9]
Yahfree won :P His example works best for my code. Thanks everyone.