05-04-2005, 08:14 PM
does anyone know how to use inkey$ for the directional arrows?
ife is Short Lets pick on it.
pacman movement
|
05-04-2005, 08:14 PM
does anyone know how to use inkey$ for the directional arrows?
ife is Short Lets pick on it.
05-04-2005, 08:28 PM
the easiest way is to put this
Code: up$ = CHR$(0) + CHR$(72) 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.
url=http://www.sloganizer.net/en/][/url]
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
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
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.
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
05-06-2005, 08:59 PM
Code: K$="":WHILE K$="":K$=INKEY$:WEND Code: FUNCTION pause 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
url=http://www.sloganizer.net/en/][/url]
05-11-2005, 12:11 AM
Good pause, but here's another way:
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?
url=http://www.sloganizer.net/en/][/url]
|
« Next Oldest | Next Newest »
|