Computer Science Canada Timing Problem |
Author: | Zeppelin [ Sun Dec 02, 2007 4:05 pm ] | ||
Post subject: | Timing Problem | ||
Ok I'm working on an RPG for my Grade 10 ISP and I want to make a Paper Marioish battle system. One of the things I need to do is a random button press as in the computer generates a random number and the player has to push the coresponding key within the time limit. Now I got the key pressing part to work but I can't get the time limit. I'm using a counter instead of Time.Elapsed. Here's what I have so far.
Now can I get this to work? |
Author: | Ultrahex [ Sun Dec 02, 2007 4:40 pm ] | ||
Post subject: | Re: Timing Problem | ||
getch stops the machine from continuing on to code below in a procedural fashion so you need to use Input.KeyDown (which i always recommend except for in non-live input.) for example:
also, you should not use randint (due to it modifying a variable, which is bad practice) instead you should use Rand.Int(lower,upper). |