INTRO: Simple examples of input commands by ChipOne4th Sep 2003 12:38
|
---|
Summary Newbies can learn some quick fundamentals on using the basic input commands in DBPro. Description This is a review and simple implementation of the following commands: Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com do text 10, 10, "Type anything in. When you want to see what you typed, press enter." text 10, 24, "This method uses the windows buffer with the ENTRY$() and CLEAR ENTRY BUFFER commands." if returnkey() text 10, 60, entry$() clear entry buffer wait key exit endif sync loop while returnkey()::endwhile wait 1000 do cls text 10, 10, "Press any letter key. As you press it, the letter will be displayed. Press keys" text 10, 24, "W-A-S-D for specials. This method uses the INKEY$() command with a select statement." text 10, 38, "Press enter to exit." select upper$(inkey$()) case "W": text 10, 60, "You're moving up." :endcase case "A": text 10, 60, "You're moving left." :endcase case "S": text 10, 60, "You're moving back." :endcase case "D": text 10, 60, "You're moving right." :endcase case "": text 10, 60, "Please press a key.":endcase case default: text 10, 60, "You're not pressing a special key, you're pressing " + inkey$() + "." : endcase endselect if returnkey() then exit sync loop while returnkey()::endwhile wait 1000 do cls text 10, 10, "Press any key. As you press it, the scan code will be displayed." text 10, 24, "This method uses the SCANCODE() command with a select statement." text 10, 38, "Press enter to exit." select scancode() case 17: text 10, 60, "You're moving up." :endcase case 30: text 10, 60, "You're moving left." :endcase case 31: text 10, 60, "You're moving back." :endcase case 32: text 10, 60, "You're moving right." :endcase case 0: text 10, 60, "Please press a key.":endcase case default: text 10, 60, "You're not pressing a special key, you're pressing " + str$(scancode()) + "." : endcase endselect sync if returnkey() then exit loop end |