Blitz Basic Programming Part 1
Blitz Basic Programming Part 1
Blitz Basic Programming � Part 1 By BlackAce227
This is the first of my Blitz Basic Tutorials that will help you learn how to make video games. In this tutorial, we will be learning how to make the ever so popular “Hello World” Program and how to comment your code. You will also learn the WAITKEY and PRINT function and how to comment your code.
First of all, you will need to have a copy of Blitz Basic Demo or Full Version. The only difference between the two is that one allows you to create stand alone .exe files and the other one doesn�t. You can still view and play your games using the demo, but you wouldn�t be able to distribute them unless the people you are distributing it to own a copy of blitz basic. The following program is similar to most other types of programming languages and the basics are virtually the same, so if you know a programming language already, this should be a breeze. If not, you will soon be a master game programmer!
So let�s get to it. First, open a new docu<i></i>ment. Click File -> New. Then you should see a bluish greenish screen that is blank. This is where you will be coding your �Hello World!� program and many others. To have our program display the words �Hello World!� you are going to need to call the PRINT function. It sounds difficult, but all you need to do is type print in the main screen. After typing the word Print, the word should have turned to yellow. If it didn�t, you can�t spell Print! Now you are going to type �Hello World!� with quotes around it like so. If you run the program as it is, it will display Hello World! Just like you typed it and the program will end. This is where the WAITKEY function comes into play. This function tells the program not to end until the user presses a key. This also allows the user to read the message before it closes.
CODE
Print �Hello World!� Waitkey
END CODE
You might think your done, and your right! But as these tutorials get harder, it will be harder and harder to see what you are doing and you might forget what you have done. This is why it is a good idea to comment your code. Commenting your code is easy and does not alter your code in any way. This helps other programmers remember what they were trying to do in there program and allows others to understand it as well. Here is an example:
CODE
Print �Hello World!� ; this is a comment! Waitkey
END CODE
Hopefully you get into a habit of commenting your code and putting using it in the future programs you write. Congratulations! You just created your first program, learned the Waitkey and Print functions and learned how to comment your code using semicolons! Part 2 on the way!
BLACKACE227
Submitted by BlackAce227 on December 13 2004 - 22:25:26