Computer Science Canada

Need Help with Putting Pause in Game...

Author:  Ryft [ Tue Jun 07, 2005 2:48 pm ]
Post subject:  Need Help with Putting Pause in Game...

How would I go about doing this? I tried just doing a simple:

code:

if chars ('p') then
    Input.Pause
end if


This doesn't seem to work if I repress the same key however. So I'm wondering how I would make a pause that would be activated and deactivated with the same key? Thx.

Author:  [Gandalf] [ Tue Jun 07, 2005 3:11 pm ]
Post subject: 

Make a boolean statement that says whether or not the key is pressed:
Turing:
var ppressed : boolean := false
var chars : array char of boolean
Input.KeyDown (chars)
loop
    if chars ('p') then
        if ppressed = false then
            ppressed := true
            Input.Pause
        elsif ppressed = true then
            ppressed := false
        end if
    end if
end loop

That should work.

Author:  Bacchus [ Tue Jun 07, 2005 9:36 pm ]
Post subject: 

Oooor
code:

var chars:array char of boolean

loop %Your main loop

%Your other stuff

   Input.KeyDown(chars)
   if chars('p') then
      loop
         Input.KeyDown(chars)
         if chars('p') then
            exit
         end if
      end loop
   end if
end loop


: