BluescreenODeff wrote:Hmm...the program you gave me returned an error "Duplicate Definition" within the Function.
Dang! Don't you just hate posted code with bugs.
Maybe by insuring the function has % everywhere consistently. But there is no driver program, so it would be hard to understand or see if the function is useful with a lot of work.
Look instead at the demo I wrote
http://www.network54.com/Forum/171757/m ... 1042468970
It actually runs! Select the asterisk-moving demo and see if that works a bit according to your need. You can possibly see better if you modify A1.Demo: Replace the timer pause in subroutine "Move2" with
FOR i = 1 TO 9: WAIT &H3DA, 8: WAIT &H3DA, 8, 8: NEXT i
The overall problem is that if you just use INKEY$, you get this
- User presses a key and holds it down
- QBasic returns the key value
- QBasic stalls a long time to make sure you really want multi-returns
- Finally QBasic starts acting as if the user is pressing key quickly
- User releases key
- There are still keypresses in the buffer and so you wind up getting jerky movement plus movement after you wanted to stop.
You can avoid the extra keypresses by something like this:
Code: Select all
DO
WHILE INKEY$ <> "": WEND
k$ = INPUT$(1)
PRINT ".";
LOOP WHILE k$ <> CHR$(27)' ESC key to stop
But the stall can't be avoided without something in assembler such as the demo I provided above.
Mac