If you missed a tip, or just want to get some pointers, you'll find what you need here.
Structure your code! Instead of:
Not all screens support the PALETTE command - but fear not! - There is a faster and better way to change your colors!
OUT &H3C8, clr '(the color # you want)
OUT &H3C9, redClr ' (the amount of red)
OUT &H3C9, greenClr ' (the amount of green)
OUT &H3C9, blueClr ' (the amount of blue)
Those commands will set the red, green, and then blue additives of the color - you can have almost any color you want! Make sure they whole numbers between 0 and 63. If you go over 63, it will start at 0 again.
--Submitted by Dom
Remember that inkey$ only shows what is being pressed at the CURRENT moment. If you make a program that loops until you press a key by checking inkey$ at the end of the loop, the inkey$ a few lines down may have changed by the time you check what it was! Copy it into a variable first (in$ = inkey$) and you can avoid moments where your program might not respond to the key you press.
--Submitted by Dom
Never made a QBasic program? Maybe you have and you need a little more experience? Surprisingly, a lot of software stores still sell books about QBasic/QuickBasic/VisualBasic. They usually run about 10 to 25 dollars, but they're worth a lot for the average programmer. There are programs and demos for you to type up, not to mention the priceless definitions right in front of you!
One of the most commonly asked questions in the QBasic world is "How do I get screenshots of my games?" Well, the answer is simpler than you think.
Run your QBasic program from Windows, not from DOS. When you see a screen you like, simply hit the "Print Scrn" button at the top right of your keyboard. Go back into Windows and paste in a graphics program, such as Paint. Voila! Instant screenshot! You can manipulate them as you wish, and change them into GIFs or JPEGs.
The key to programming is the structure in which you make it. For example, I usually make the engine of the program first and finish it before I move onto a title screen, menu, etc. The problem with some newbies is they make their title screen and menus first before making the guts of the program. So, often, the first half looks really sloppy and the second half looks neat, because the programmer is learning more and more as he is programming. Consider your program's structure before you make it, and if you want, maybe it would be smart to make a programming schedule!
You can't just have pictures and not sound in a program. Consider adding SOUND statements. QBasic sound pitch can go as low as 45 and as high as 35000. Try addding a few SOUND (pitch), (length) commands to your programs to spruce them up.
Animation! Everyone wants it, but many are puzzled how to create smooth flowing animation. Why do I get that flicker everytime I CLS? Get into page flipping. A nice example of page flipping is SCREEN 7, 0, 1, 0. Make your graphics as usual, and everytime you want to flip the screen, type PCOPY 1, 0 and GOTO your CLS command (not the SCREEN statement). Feel free to study my code and see how I create the animation using page flipping. It'll come in handy.
Hey, are you tired of those question marks after INPUT commands? Do you want to ask the user "Pick a number" without the annoyance of a question mark? I have a problem-solving tip that might come in useful.
Type this: INPUT "Pick a number: ", NUM
Look, no question mark! By using a comma, instead of a semicolon, that pesky question mark is deleted.
Instead of having to painstakingly type out the word "PRINT" for your programs, do what I do and just put a "?" and then move your cursor away from that line. Your question mark will change into a PRINT command! Also, instead of using REM for remarks (I still see those), just use one of these: " ' Your message here."