Am I too late??

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Disk1of64
Newbie
Posts: 5
Joined: Fri Jul 27, 2007 3:59 pm

Am I too late??

Post by Disk1of64 »

Hello there peoples,

I just came across this site and thought it was pretty cool. I am almost 23 yrs old and wondering if its too late for me to try to learn to program. Some research about beginers programming lead me here by suggesting Qbasic. I am wanting to learn to program my own games, in the 8bit or even atari style. From websites I have glanced at, it seems Qbasic is perfect for this. So, can someone plz help to point in the direction of the best way to go about learning Qbasic for a total programming noob? In the meantime I'll keep trying to find good tutorials.
User avatar
Stoves
Veteran
Posts: 101
Joined: Fri Feb 10, 2006 12:24 am
Location: Nashville, TN

Post by Stoves »

Never too late to learn!

http://www.petesqbsite.com/sections/tut ... rs.shtml#1 contains some links to good starting material.

http://www.qbasicstation.com/ has some decent tutorials as well. Check out the Command Tutorials link for a nice quick reference to Qbasic commands.

By the way, do you already have qbasic installed and working? or do you need info on getting the files and installing qb?

This forum can be a great source for getting most questions answered if you don't have luck with the tutorials. Have fun.
Disk1of64
Newbie
Posts: 5
Joined: Fri Jul 27, 2007 3:59 pm

Post by Disk1of64 »

I have it installed and everything(Qbasic 1.1 from Downloads.com). I am just kinda clueless about where to start. I mean I realize to be able to program anything I am going to have to learn the basics first. I guess I'm just worried about wheather or not I am smart enought to put it all together after I learn commands and such. Don't get me wrong, I'm not stupid, I just have a tendancy to make stuff harder than it is. I guess thats why several people recommended I start with Qbasic. Thnx for the other site too. It was pretty cool. I like the QBNerd short alot.
Also, a lil while ago I downloaded Space Commando 2 from the games section. That game is friggin awesome! Things like that and the original Duke Nukem are exactly what I'm after. Are games like that really hard to program?
User avatar
Stoves
Veteran
Posts: 101
Joined: Fri Feb 10, 2006 12:24 am
Location: Nashville, TN

Post by Stoves »

lol I LOVED those games! Classics! :) Programming those kinds of games is completely doable in QBasic, but it takes a while to get to that point. However, I believe anyone with the desire and the willingness to commit some time can learn how to program. And yeah, QBasic is a GREAT language to start with, because it's pretty simple, but still powerful enough to do a lot. I'm sure you'll be able to pick it up with no problem. Plus the guys on this site are awesome. You can learn a ton from their code, and they really help with questions too.

In addition to reading the tutorials and trying out the code, it's a good idea to think of simple programs and then use the QBASIC command reference guides to figure out which commands are needed for those programs. I'm sure people on this site could give you a lot of good ideas for simple programs to practice learning how to use QB.


Some important basic commands that you'll use frequently:

CLS - clear the screen
example:

Code: Select all

CLS
PRINT "text" or PRINT variable - display some text to the screen
example:

Code: Select all

PRINT "Hello, world!"
Greeting$ = "Hello, "
Name$ = "Stoves"
PRINT Greeting$ + Name$ + "!"
INPUT "text"; variable - prompts the user for information typed from the computer keyboard
example:

Code: Select all

INPUT "What is your name"; Name$
PRINT "Hello," + Name$
SLEEP number of seconds - pause the program for a specified number of seconds
example:

Code: Select all

PRINT "I'm thinking of a number..."
SLEEP 3
PRINT "and it just happens to be my credit score."
LOCATE row, column - moves the cursor to a specific location on the screen
example:

Code: Select all

LOCATE 10, 10
PRINT "Hello, world!"
REM or ' - indicates the current line is just a comment
example:

Code: Select all

REM This line is ignored by the program.
' This line is also ignored by the program.
PRINT "It's always a good idea to comment your code."
' There's almost no such thing as too many comments in programming.
IF evaluation expression THEN execute expression ELSE alternative execute expression - the cornerstone of programming; allows running the execute expression based on whether or not the evaluation expression is true; also, ELSE can be added to give an alternative execute expression if evaluation expression is not true.
example:

Code: Select all

'Clear the screen
CLS
'Position the cursor a little ways down the screen.
LOCATE 10,1
'Print text asking the user for their name. The ";" symbol positions the cursor one space after whatever is printed.
PRINT "What is your name?";
'Get the user's name.
INPUT Name$

'Print a greeting based on whether or not the user's name is "Stoves"
IF Name$ = "Stoves" THEN PRINT "Hey, man! You rock!" ELSE PRINT "Sup, chump."
FOR variable = number TO number
code
NEXT
- loops through the same code a certain number of times by setting and increasing the value of variable.
example:

Code: Select all

FOR x = 0 TO 10
  PRINT "X=";
  PRINT x
NEXT
DO
code
LOOP
- just repeat the code over and over; optionally (and often) UNTIL is added to the DO or the LOOP command to cause the program to exit the looping code.
example:

Code: Select all

'Clear the screen
CLS
'Explain the rules.
PRINT "Guess the number I'm thinking of and be congratulated!"
'Pause so there's time to read the rules.
SLEEP 3
'Set the number variables to an initial value
userGuess = 0
secretNumber = 13

DO
'Move the cursor to the beginning of the first row
LOCATE 1,1
'Clear the row of any previous text
PRINT "                              "
'Return the cursor to the beginning of the first row
LOCATE 1,1

'Prompt the user for a number
INPUT "What's your guess"; userGuess
'If the guess is incorrect, let the user know
IF userGuess <> scretNumber THEN
  PRINT "Nope, wrong answer."
END IF
LOOP UNTIL userGuess = secretNumber
PRINT "You got it! Congrats!"
These are commands that you'll want to start learning and using immediately. Good luck.
User avatar
Stoves
Veteran
Posts: 101
Joined: Fri Feb 10, 2006 12:24 am
Location: Nashville, TN

Post by Stoves »

Also check out http://members.lycos.nl/rubynl/ for some additional helpful beginning tutorials.
Disk1of64
Newbie
Posts: 5
Joined: Fri Jul 27, 2007 3:59 pm

Post by Disk1of64 »

Thanks again for all the tips guy. I will try to get practicing on those codes this weekend. Hate to keep askin for the help but, if anyone can recommend books or anything that'd be cool too. I guess I just got the idea its going to be really hard to "teach yourself" Qbasic.
User avatar
Stoves
Veteran
Posts: 101
Joined: Fri Feb 10, 2006 12:24 am
Location: Nashville, TN

Post by Stoves »

It's not hard to teach yourself QBasic if you map out specific goals and have good reference materials. Pete's Qb site and the other sites i linked have all you'll need in the area of reference materials to get started.

The key will be deciding on specific projects that interest you. Necessity is truly the mother of invention when it comes to programming, so I would highly recommend starting a cycle of picking a particular type of program to complete and then researching and asking about how to do particular tasks related to that program. And of course, don't hesitate to post questions on the forum.

Here's a list of program ideas that are relatively short, but reasonably challenging for learning how to program in QB. I'm sure you'll find lots of ideas all over Pete's QB site too.

Simple Calculator - Simple calculator that accepts user-entered equations and provides the answer.
Programming Focus - user input, basic logic
Estimated Difficulty - 1/5
Example:
Prompt: "First Number:"
User Input: "5"
Prompt: "Second Number:"
User Input: "3"
Prompt: "Operation? (A - addition, S - subtraction, M - multiplication, D - division)"
User Input: "M"
Output: "5 x 3 = 15"

Number Guessing Game - Asks the user to think of a number between 1 and 100 or 1000 or whatever, then proceeds to guess the number. The user indicates whether the guess was too high, too low, or correct. (by a numbered menu, input h, l, c, or some other method, etc.)
Programming Focus - simple logic, user input/interaction
Estimated Difficulty - 2/5
Example:
Prompt: "Think of a number between 1 and 10. Hit a key when ready."
Prompt: "Was your number 5? (Y or N)"
User Input: "N"
Prompt: "Was your number higher or lower than 5? (H or L)"
User Input: "L"
Prompt: "Was your number 3? (Y or N)"
User Input: "You suck."
Prompt: "Was your number 3? (Y or N)"
User Input: "Y"
Output: "Yay. I got it."

Clock/Timer - Displays the current time. Allows the user to set a timer, which counts down to zero and alerts the user when time's up.
Programming Focus - Accessing and using time and timers
Estimated Difficulty - 2/5

Modern Art - Draws random lines, circles, and squares of varying lengths, colors, and positions on the screen.
Programming Focus - Basic graphics, randomizing
Estimated Difficulty - 2/5

Palindrome Verification - Asks the user for a word or phrase and confirms whether or not that word/phrase is a palindrome (spelled the same backwards as forward). Ignore's punctuation, whitespace, or any other non-alphanumeric characters in the evaluation. Not case-sensitive.
Programming Focus - String manipulation/evaluation
Estimated Difficulty - 3/5
Sample Inputs:
"poop" - Yes
"stoves" - No
"Madam, I'm Adam." - Yes
"BOb" - Yes
"bob" - Yes
"B ob" - Yes
"This is a Palindrome" - No

Sorting Program - Asks the user for a list of names or words and returns the list sorted in alphabetical order.
Programming Focus - data sorting, arrays
Estimated Difficulty - 3/5
Example:
Prompt: "Input Names"
User Input: Steve, John, Jill, Becky, Dan, Daniel, Mike, Alice
Final Output: Alice, Becky, Dan, Daniel, Jill, John, Mike, Steve

Bouncing Ball(s) - One or more balls bounce around a blank screen
Programming Focus - basic graphics manipulation
Estimated Difficulty - 3/5

Text-based Frogger clone - Using different ascii characters instead of images, user controls a frog and moves him across a street without getting smashed by cars.
Programming Focus - Game logic, user input/interaction
Estimated Difficulty - 4/5
Sample Screen:
---------------FROGGER-------------------
|===☻========☻======☻====|
|▒▒▒===▒▒▒▒==▒▒▒▒===▒▒|
|=▒▒▒▒▒▒▒==▒▒▒=▒▒▒▒▒==|
|▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒|
|.......................................................|
........................................................|
|.............................██▄.................|
|..............................□...□.................|
| -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -|
|..........▄█▄....................................|
|..........□....□....................................|
|░░░░░░░░░░░░░░░░░░|
|░░░░░░░░?░░░░░░░░░░|
---------------------------------------------

Graphics-based Frogger Clone - The real thing. Full-fledged Frogger game, graphics and all.
Programming Focus - Game logic, user input/interaction, graphics
Estimated Difficulty - 5/5
Post Reply