Computer Science Canada Need help on character control using the Input.Down and delay |
Author: | kar [ Fri Feb 24, 2012 5:49 pm ] | ||
Post subject: | Need help on character control using the Input.Down and delay | ||
What is it you are trying to achieve? trying to control a character using the arrow keys for my snake game What is the problem you are having? if a key is pressed during the "delay" the action does not take place Describe what you have tried to solve this problem no clue how to solve it Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using 4.1 |
Author: | evildaddy911 [ Fri Feb 24, 2012 8:04 pm ] | ||
Post subject: | Re: Need help on character control using the Input.Down and delay | ||
The best way to fix it is to decrease the delay. Another way to fix it is to use processes; right before the procedure, put
and take out the input.keydown in the main loop Remember; thus may not wok, you may need to play around withit a little |
Author: | Aange10 [ Fri Feb 24, 2012 8:12 pm ] |
Post subject: | RE:Need help on character control using the Input.Down and delay |
Alternatively, you could loop Input.KeyDown in a loop that doesn't exit until the time you wanted to pass has passed. |
Author: | Raknarg [ Sat Feb 25, 2012 9:40 am ] | ||
Post subject: | Re: Need help on character control using the Input.Down and delay | ||
evildaddy911 @ Fri Feb 24, 2012 8:04 pm wrote: The best way to fix it is to decrease the delay. Another way to fix it is to use processes; right before the procedure, put
and take out the input.keydown in the main loop Remember; thus may not wok, you may need to play around withit a little Don't feed him false information. Never use processes. There have been too many arguments about this as it is. |
Author: | kar [ Sun Feb 26, 2012 12:20 am ] |
Post subject: | RE:Need help on character control using the Input.Down and delay |
if i higher delay than is there a way to slow the skake down |
Author: | evildaddy911 [ Sun Feb 26, 2012 8:05 am ] |
Post subject: | RE:Need help on character control using the Input.Down and delay |
Use real numbers for your snake coords and round() for anything that requires them to be insegers |
Author: | Aange10 [ Sun Feb 26, 2012 10:13 am ] | ||
Post subject: | RE:Need help on character control using the Input.Down and delay | ||
If you MUST have input during a delay, here is an idea for it.
However this is an example with Time.DelaySinceLast (x) not Delay (x). They are basically the same thing, except delay will stop the program for x milliseconds, where Time.DelaySinceLast will keep the program from going faster than x milliseconds. |