
-----------------------------------
Hakneedshelp
Wed Jan 18, 2017 7:07 pm

Window of Time
-----------------------------------
What is it you are trying to achieve?



What is the problem you are having?
My program is a bunch of procedures that are called from keyboard commands. (Input.KeyDown) It is a sort of reaction game. The procedure have to have a window of time to input the keyboard answer. For example, if you need to press F to survive, I need a window of time to press F, which I found to be not possible through delays or for loops.


Describe what you have tried to solve this problem
I tried to put the Input.KeyDown commands into the procedures, however, they programs jumps back into the procedures once theyre called out to a different procedure. I also tried to create that window of time through delays and for loops, but no commands can be inputted while a delay or for loop is active.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)





%here is a sample of the code...
procedure dodge1
put "Hello"
end dodge1


procedure bossfight1
Font.Draw("DODGE WITH F!",200,175,fontIDtext,black)
drawfillbox(0,0,maxx,maxy,7)
Font.Draw("GAME OVER",200,200,fontIDMainScreen,31)
end bossfight1



loop
    Input.KeyDown (chars)  
            
            if chars ('f') then  
                dodge1 
             end if

    end loop  



Please specify what version of Turing you are using
Using Turing 4.1.1

-----------------------------------
NightOwl
Wed Jan 18, 2017 10:16 pm

RE:Window of Time
-----------------------------------
I don't really understand your question. What do you mean by "A window of time"? Can you explain in more details about how you'd want the program to behave?

-----------------------------------
Hakneedshelp
Thu Jan 19, 2017 7:48 am

Re: Window of Time
-----------------------------------
The Key actions cannot be inputted-In other words, i need a way to delay a certain amount of time while still being able to input key commands. using a standard delay doesn't work, nor does using a really long for loop.

-----------------------------------
Insectoid
Thu Jan 19, 2017 9:05 am

RE:Window of Time
-----------------------------------
Time.Elapsed returns the number of milliseconds since the program started running. I'm sure you can find a way to use this to your advantage!

-----------------------------------
5c0r910n
Thu Jan 19, 2017 9:41 am

RE:Window of Time
-----------------------------------
MOD EDIT: Try not to give out the answers guys. We'd rather help you figure it out for yourself.
