Issue 2 - April 2000


Game tutorial series #1 - graphics


 

Writer: Provgamer

Ok everyone this is my fist tutorial so please excuse any problems! Anyway in this tutorial I'm gonna go over the basics in starting a game. Ok I'm gonna be honsest, all those tutorials that tell you to plan everything FORGET THEM!!! That's right you don't have to spend hours of planning a game, just have a basic idea of your game and then add-on to it as you get more ideas! Well anyway on with the tutorial...

To even start a game you must know some simple graphic commands! Such as:

1. PSET
2. LINE, CIRCLE
3. How to use the DATA command

Ok. Now how to use PSET. Try this...

SCREEN 13 : CLS 'this sets the Screen mode to 13 and clears screen
FOR y = 0 TO 100 'this gives a number from 0 to 100
FOR x= 0 TO 100 'gives a number from 0 to 100
PSET (x, y), 4 'draws the graphic (x is the vertical location, y is the horizontal location) 4 is the color number red. NEXT x 'completes the x loop
NEXT y 'completes the y loop

Confused? Maybe we should try something a little more simpler! Try this...

SCREEN 13 : CLS
PSET (100,100), 4
PSET (101,101), 5
PSET (102,102), 6

Ok. If you are still confused then think as the screen in qbasic as being a big graph. X is the vertical lines and Y is the horizontal!

So now the commands

PSET (2, 3), 4
PSET (2,4) , 4

would be shown like this:

ASSIGNMENTS:

1. Draw a picture of the letter I.
2. Use the FOR...NEXT in PSET to make squares.
3. Experiment with PSET. Get to know the locations on the screen.

Ok now you should know enough on how to locate spots on the screen by using PSET. I will now attempt to show you the LINE command. First on PSET you pick a spot for a single dot or pixel. Now on the LINE command it's basically the same strategy only you give 2 locations!

LINE (10, 10)-(20, 20), 4

Let's break this command up so we can understand it! The (10, 10) is the location where the LINE will start. (20, 10) is the end of the line. The 4 is the color we chose (which is red)

Now there is another part of the LINE command which is kind of neat. If you wanted to make a square then you'd put in the coordinates of the squre like this:

LINE (10,10)-(20,20), 4, B 'b means block I think

Or it could be

LINE (10,10)- (20,20), 4, BF 'BF means Block Fill I think

I'm not gonna go into anymore depth on the LINE command. The only thing I can tell you is to experiment yourself with this.

Now I'm going to ATTEMPT to explain the DATA command! This is the most precise method of placing pixels. I'm giong to describe how to use it in screen 13:

SCREEN 13: CLS

FOR y=0 TO 4 'Gives us a 5x5 tile
FOR x=0 TO 4

DATA 00,04,04,04,00 'Data for pixels NOTE: #'s = the color #
DATA 04,00,00,00,04
DATA 04,00,10,00,04
DATA 04,00,00,00,04
DATA 00,04,04,04,00

READ Pixles 'Read the data as Pixels
PSET (x,y),Pixels 'Locate x,y and put Pixles there
NEXT x 'Finish x and y loops
NEXT y

Ok now This pretty much self explanatory! So use the example to figure it out! If you cannot make sense of it then check the help file or email me!

Thanks for reading...and GOOD DAY!!!

Provgamer...

Next tutorial I will be going over the GET, PUT, BLOAD, BSAVE commands! This tutorial will ONLY be found in QB CULT MAGAZINE! Well see ya then!