Tutorial

GL (very) Basic Tutorial

aka "so, you want to write a game, do you?"
© 2008 PeeJay

Foreword

Firstly, let me say this - I am not an expert programmer, and can only recall information that I have experienced myself, and from discussing problems with other programmers. However adept you are at programming, there will always be someone who is better than you. No, wait, that is the wrong word. Let me rephrase that. However adept you get, you will always discover someone else's work and be perplexed at how they achieved what they did. That is one of the beauties of programming - it is a continual learning experience - there are no set rules to follow - and the more practice you get and the more different things you try to achieve, the more you will learn. If you try to do something, and it doesn't work, don't be disheartened - this is also part of the learning process - learning how things work when they do, and why when they don't.
The object of this tutorial is to introduce a few more people to the world of programming in GL Basic, how easy it is, and introduce some features of GL Basic, which, although being used very simply in these tutorials, can be used to create some very powerful programs. I make no apologies for this being fairly simplistic, and, to some that are already programmers but just want to get to grips with GL Basic, even patronising - it is designed that anyone can follow what is going on. It is not designed to be a manual for basic, and indeed, many of the important commands are not used at all in the game we create, but I will explain the commands I do use, and how they work and interact with each other, so if you are not familiar with the basic language, reading this could provide a stepping stone into learning it.
Each tutorial will have a source code listing, fully commented within the doc files, so it is best to read this file along with the source code, as the source code will be changing in order to create a fully playable (if very simple) game. GLBasic does come with many demos itself, but I found them either way too advanced for me to examine, or, for those demos that were easy to follow, I was left wondering what to do next. Hopefully, this tutorial will help with basic game design, and start a few people on the way to creating a masterpiece.
So, what are the tools of the trade? Well, obviously GL Basic, a graphics package (I personally use Paint Shop Pro, but even plain Windows Paint will suffice) and, presuming you want music, some sort of music creation package. Alternatively, sounds and music can readily be found on the net - graphics are a bit harder, however, since the chances of finding just what you are looking for are very remote.
So, what are we going to create? Well, like I said, it's going to be something easy to start with, but, the finished product will be playable, and will leave lots of room for improvement! And since you will have been with me every step of the way during programming it, you will know exactly how everything works, so have an ideal basis to work on.
For those of you that are not aware, if you highlight a command in GL Basic and press F1, it will bring up the help file on that command - don't be frightened to use it; I still do from time to time! I hope that these files will give the new users both an insight into how to use GL Basic, and the confidence to go on and create their own works.
Anyway, on with the show!