05-04-2005, 08:14 PM
05-04-2005, 08:28 PM
the easiest way is to put this
at the top of your code (after declares etc.)
Then you just have to do
The INKEY$ command isn't very good though so doing
in the loop of your code then doing
then do
NOTE: In the IF's change the up$ to down$ for down and so on.
Code:
up$ = CHR$(0) + CHR$(72)
down$ = CHR$(0) + CHR$(80)
lft$ = CHR$(0) + CHR$(75)
rght$ = CHR$(0) + CHR$(77)
at the top of your code (after declares etc.)
Then you just have to do
Code:
IF INKEY$ = up$ THEN 'do all the stuff you want it to do when the up arrow is pressed
The INKEY$ command isn't very good though so doing
Quote:key$ = INKEY$
in the loop of your code then doing
then do
Code:
IF key$ = up$ THEN 'do all the stuff you want it to do when the up arrow is pressed
NOTE: In the IF's change the up$ to down$ for down and so on.
05-05-2005, 03:26 AM
TheDarkJay:
Very good!
For capturing the INKEY$ content, the following has always worked very well for me:
K$="":WHILE K$="":K$=INKEY$:WEND
Very good!
For capturing the INKEY$ content, the following has always worked very well for me:
K$="":WHILE K$="":K$=INKEY$:WEND
05-05-2005, 04:13 AM
Quote:K$="":WHILE K$="":K$=INKEY$:WENDThat loops until you press a key. That means you can't have the program do other stuff. (Like having ghosts move or have pacman continue moving)
05-05-2005, 07:44 AM
WhiteTiger0990:
Yes, I see what you are telling me. And, yes, my use was limited to programs that required user input to continue, not games such as you imply, so, my method would not work there. Thank you for noticing this limitation.
Yes, I see what you are telling me. And, yes, my use was limited to programs that required user input to continue, not games such as you imply, so, my method would not work there. Thank you for noticing this limitation.
05-06-2005, 08:59 PM
Code:
K$="":WHILE K$="":K$=INKEY$:WEND
Code:
FUNCTION pause
WHILE INKEY$ = "": WEND
END FUNCTION
As far as i am aware there is no difference (or i cannot spot one) when just having it run like that, it is only when you have other things inbetween it when
Code:
k$ = INKEY$
Code:
WHILE k$ = 'some other button, "q", CHR$(27) (escape) or " " (space bar) are common ones
05-10-2005, 08:45 PM
thank you i will try ur ideas
05-11-2005, 12:11 AM
Good pause, but here's another way:
If any button is pressed, it continues. Otherwise, you could change the "" to a CHR$(##) to mak a specific, like
Then, it only goes if the Enter Key is hit.
Code:
DO: LOOP UNTIL INKEY$ > ""
If any button is pressed, it continues. Otherwise, you could change the "" to a CHR$(##) to mak a specific, like
Code:
DO: LOOP UNTIL INKEY$ > CHR$(13)
Then, it only goes if the Enter Key is hit.
05-11-2005, 08:19 PM
Don't you mean this?
Quote:DO: LOOP UNTIL INKEY$ = CHR$(13)Or will greater than work as well?