Computer Science Canada Keydown Input |
Author: | CLPost [ Sun Jun 14, 2009 8:14 pm ] | ||
Post subject: | Keydown Input | ||
What is it you are trying to achieve? A arrow appears at the top of the screen, the user must input the shown arrow and the x variable either increases if they press wrong or decreases if they press right What is the problem you are having? I can't seem to make the x variable go up or down in value, when the specific key is pressed Describe what you have tried to solve this problem I tried rearranging the code but it hasn't helped much Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using 4.1.1 |
Author: | BigBear [ Sun Jun 14, 2009 8:27 pm ] |
Post subject: | RE:Keydown Input |
you are changing the value of x but you are not doing anything with it try putting it instead of maxx |
Author: | TheGuardian001 [ Sun Jun 14, 2009 8:30 pm ] | ||
Post subject: | Re: Keydown Input | ||
In the future, if your code has images, include the images. We can't run your code if we don't have them. So, with the knowledge that I couldn't actually run your program and that I'm totally guessing here, I would say that the problem is that you never actually use the variable "x". Ever. You change it with the arrow keys, but you aren't drawing based on "x", and you never use it outside of the input checking, so why would anything change? Your drawing code:
Why are you saying to draw at "maxx div 2 + 10" if you want it to draw at "x"? EDIT: Ninja'd by BigBear ![]() |
Author: | CLPost [ Sun Jun 14, 2009 8:32 pm ] |
Post subject: | RE:Keydown Input |
my bad i just noticed that I was putting maxx instead of the x var...... my bad guys thanks for your help |
Author: | BigBear [ Sun Jun 14, 2009 8:35 pm ] |
Post subject: | RE:Keydown Input |
Also in your main loop you are calling Input.KeyDown (key) and then calling again in your proc so the one in your main loop isn't being evaluated You should be using parameter lists or just having one loop so you are not declaring and assigning variables everytime. |
Author: | CLPost [ Sun Jun 14, 2009 8:39 pm ] |
Post subject: | RE:Keydown Input |
actually is there anyway to improve the reposiveness of the inputs cause im spaming it and it only reacts 1/10 times =S |
Author: | CLPost [ Sun Jun 14, 2009 8:41 pm ] |
Post subject: | RE:Keydown Input |
nevermind im dumb.... i just had to change the delay my bad again |
Author: | BigBear [ Sun Jun 14, 2009 8:43 pm ] | ||
Post subject: | Re: Keydown Input | ||
I don't know why you have eight different variables for picture. You are only using 3. If you renamed your images you could have
|
Author: | CLPost [ Sun Jun 14, 2009 8:58 pm ] |
Post subject: | RE:Keydown Input |
er the 8 different variables were for later parts of the program =S i guess i could use the "pic" intstr "jpg" thing but usually i only use it for picnum =S |