Welcome to J's 9-step school of Basic programming!
This mini-course will attempt to get you up to speed on the basics of the BASIC programming language in the fastest and most efficient way possible. When you complete all 9 lessons you will be capable of creating text and graphic games, interactive quizzes, problem solvers and whatever your mind can imagine! Programming is a powerful tool for improving logical thinking, scientific reasoning, simulation and visualization skills.
Blitz BASIC will be our version of choice because it is a powerful tool that can create fast programs QUICKLY and EASILY. BASIC is the best language to ease you into programming and still has the power to create fantastic programs and games.
Each of the 9 lessons is divided up into 3 sections
1) List of new BASIC commands with a short description
2) A fun sample program to copy into the editor and RUN
3) The CHALLENGE assignment to modify the sample and make it your own!
1) Secret LOGIN:
3) Random Numbers
6) Movable SPRITE
7) Artificial Intelligence
8) Graphing Equations
9) Missile Launcher
| Lesson 1 - SECRET LOGIN: (Must know secret password to log in)
1) LIST OF NEW BASIC COMMANDS:
Sets the window size to 640 x 480 pixels, 16 bit color mode, 2 = windowed
Clears the screen blank. A good way to start.
Name$ = Input$("words")
The program pauses and prompts you to ENTER keystrokes. Variable Name$ stores keystrokes. Name$ can be most any word but don’t forget “$”. If you want the user to enter numbers instead of letters you can leave off the "$", e.g. Num = Input("Pick a number")
PRINT "HELLO, " + A$
Prints whatever is between the quotes to the screen, numbers, variables (A$), etc. The "+" causes A$ to be printed right after whatever is in the quotes. You can string together many words and variables this way.
IF ... THEN ... OR ... AND ... ELSE ... END IF
These powerful logic commands allows you to perform a task IF certain conditions are met.
e.g. IF N=5 THEN PRINT"Hello" or IF A$="FRED" THEN GOTO here2
Place a word after a period anywhere in your program so that you can GOTO that location if desired. LABEL can be any word or number that isn't a command
Just like you would think. Branch directly to wherever "LABEL" is placed
Pauses the program for 1000 milliseconds (1 second), 5000 = 5 seconds
End of the program
2) SAMPLE PROGRAM: SECRET LOGIN:
Copy/Type the following program in the Editor and RUN (F5)
NAME$ = INPUT$("USER LOGIN:")
PASS$ = INPUT("PASSWORD:")
IF PASS$="TWOLF" THEN GOTO LOGIN
PRINT "SORRY, "+NAME$+"...INCORRECT PASSWORD"
PRINT"WELCOME, "+NAME$+"...YOU NOW HAVE ACCESS."
3) THE CHALLENGE:
Change the password and welcome message. SAVE AS your initials with a number 1.