:Lbl X :ClrHome :Repeat A :getKey->A :End :Disp A :If A=25 :Then :Output(4,8,"UP") :Else :If A=26 :Then :Output(4,8,"RIGHT") :Else :If A=24 :Then :Output(4,8,"LEFT") :Else :If A=34 :Then :Output(4,8,"DOWN") :Else :GOTO X
Is this your whole code? I put that into my calculator and it worked fine.
P.S. After If/Then(/Else) blocks it's a good idea to put an End for each Then. Check out this page to see what I mean.
Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future
I'm trying to get one direction by pressing one key and then without having to press enter, press another key and get another direction.
You would have to put the key direction code inside the Repeat loop to do that.
How would I do something like that? I am a little confused about the repeat function.
Like burr said, the Elses are causing a memory loss. But the Elses are doing more than just that. The reason its not repeating is because of the Else statements. Else means ONLY do this if the previous If condition wasnt true. Your code had
at the end
That means ONLY Goto X if its not an arrow key. Try End. Replace all the Elses with Ends.
Even better, since there s only 1 thing to do, delete all the Thens and Elses.
Hope this helped!
almost works! the only thing is it displays for a fraction of a second then goes away. How do I make it appear until the next arrow key is pressed?
Oh! It displays it, then Gotos X. There, you have it ClrHome. The ClrHome is causing the problem. Have it ClrHome after getting the getkey value.
I think that will solve it.