Blitz3D Newbies: Starting out in Blitz3D
by Michel Yuy (Michael King)

Starting out in B3D

I have had Blitz 3D for about a week now, and at the beginning it was A camera?! what the hell? because i was a 2D programmer mainly using BB. So, now that I have grasped the basics (thank you Krylar!), i would like to teach you the basics of the wonders od B3D! To start out, you will need a graphics mode, as with any program. So, all you need is this:


There you are! this sets out the resolution and the type of graphics mode you want. (If you did not put it in there, or put just 'Graphics' and your resolution, you will have a 2D mode. NOT WHAT YOU WANT! After this you will want to set up the buffers. Buffers come in twos (back and front), and the front is the code, and the back is the output, or the actual game interface, so you will need the back one. So include this:


what this does is to set the backbuffer as the one you want to have the game stuff on (if you get that). Before we go any further, all 3D entitys (things) has to have as light source, so we will set up a good light source, white:


Now, the coolest thing that you could possibly have is the camera (in B3D), because without it, you wouldn't be able to see anything, and you can do cool things with it. So, next, you need to set up a camera:


Badabing! you now have the camera, and where it starts (0,0), and how big it is (800,600) (it is best to keep the first 2 0,0 to start out with, and to keep the last 2 as your resolution). Now, it would be very boring if we left it like that, wouldn't it? So, let us add a cube:


this creates the cube, and moves it into position on the 3 axis (0,0,5 - x.y.z) So there you go. Right, we have created it, now methinks we should texture it!! We now need to code in:


There we are. You will need to create your own texture for this though. So replace "a.bmp" with your own "*.bmp" file. Do you think that a static, textured cube is exiting? no, cos it will look like a square! We will need to set up a main loop now, so:


This sets up a loop so that anything that happens, repeats until the user presses 'Esc' (1) Now, to turn that cube:


This sets it quite slow, but you can speed it up by removing the decimals and replacing the intergers with 4,5,6 to speed it up:


remember, only ONE of these two will do! Now, for 2 of the most important commands in b3D, because without them, you will either get horrible trails, or you cannot see anything:


To finish it all off:


'Flip' flips the buffers, so the back one is brought forward, 'Wend' ends the 'While' loop and End ends it, basically. You have now created a spinning cube. well done.


For a printable copy of this article, please click HERE.


This site is Copyright© 2000-2004, BlitzCoder. All rights reserved.