Computer Science Canada

5 player gaming program :idea:

Author:  viks101 [ Mon Jun 05, 2006 9:31 pm ]
Post subject:  5 player gaming program :idea:

need feed back on creating a 5 player gaming program in which the players have to press one of the 5 buttons before the buzzer, however if they press it before they should immediately get disqualified. How can i store the input from the user before the program goes over the if statements

Author:  Clayton [ Mon Jun 05, 2006 10:32 pm ]
Post subject: 

just use your variables before your if statements ex

Turing:

Input.KeyDown(keys)
if Time.Elapsed-timeSinceLast>1000 then
put "Too quick"
else
%etc etc
end if


or else this might be something for *gulp* processes, although i would highly suggest you try different routes before you try processes Smile

Author:  TheOneTrueGod [ Tue Jun 06, 2006 6:57 am ]
Post subject: 

Ugh, this is DEFINETLY not a situation for processes. The easiest way I can see to do this would be to have two loops, and to use your current method.

Pseudo Code:
code:

Randomize the time you want to wait (In milliseconds)
loop
    if they press their key now, tell them they lose, and set their respective flag to false

    exit when Time.Elapsed > TimeAtStartOfGame + RandomizedWaitTime
end loop

drawfilloval(100,100,50,50,brightred) %Cuz I like a bright light rather than small text saying "Press your button now"

do a check to make sure that someone is still in the game

%Second loop
loop
   exit when someone who wasn't disqualified presses their button.
end loop
Display the winner.


: