Author |
Message |
therealbuba
|
Posted: Sun Apr 26, 2009 6:17 pm Post subject: Movement Help |
|
|
What is it you are trying to achieve?
Get a plane in an animation to move according to how directional buttons.
What is the problem you are having?
Turing only takes one Input keydown at a time.
Describe what you have tried to solve this problem
I created two array char of boolean for Input Keydown and an if statement for them. Basically i want the plane to move up and right when i press up and right arrows.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
For example
code: | elsif a (KEY_UP_ARROW) and b (KEY_RIGHT_ARROW) then
vy := vy + 3
vx := vx + 5 |
where a and b are two array char of boolean vars
Please specify what version of Turing you are using
Latest
Would appriciate the help guys |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Dusk Eagle
|
Posted: Sun Apr 26, 2009 7:13 pm Post subject: Re: Movement Help |
|
|
This works fine for me. |
|
|
|
|
|
therealbuba
|
Posted: Sun Apr 26, 2009 8:33 pm Post subject: RE:Movement Help |
|
|
Really? For some reason it won't work for me... |
|
|
|
|
|
Dusk Eagle
|
Posted: Sun Apr 26, 2009 8:58 pm Post subject: Re: Movement Help |
|
|
Are you sure the problem is with your character inputs and not your logic for moving the plane up? Try commenting out all the code within the condition and simply typing "put true". Be sure to View.Update if necessary. Then see if pressing those two buttons outputs "true" to the screen. |
|
|
|
|
|
therealbuba
|
Posted: Sun Apr 26, 2009 9:05 pm Post subject: RE:Movement Help |
|
|
No my logic fine, it works when i use only one of the inputs to move the plane, it moves up and down corresponding to arrows as well as right and left, however when combining it only moves in the direction of the first arrow pressed. |
|
|
|
|
|
DifinityRJ
|
Posted: Mon Apr 27, 2009 11:15 am Post subject: Re: Movement Help |
|
|
Code is self-explanatory.
Does this help, or were you trying to do something else?
If you put elsif for each new key, you can only press one key at a time. However, if they are in different if-statements you can press multiple keys at a time. |
|
|
|
|
|
therealbuba
|
Posted: Mon Apr 27, 2009 4:23 pm Post subject: RE:Movement Help |
|
|
K thank you so much i got it
+bits |
|
|
|
|
|
|