|I learned Blitz3D by studying the built in SAMPLES (they were heavily commented with helpful explanations) , 3D tutorials, Command Reference, and
especially the official Blitz3D forums,
code archives and toolbox! For beginners though this is NOT the easiest way to learn. I first learned BASIC on a TRS-80 Model II back in the early 80's. The manual that came with it had lots of exciting game examples, explained things simply, and introduced new commands only when absolutely necessary. This is what I am attempting to recreate for you here. So, get ready for an exciting adventure in coding a real 3D game that will be FUN & ADDICTING!
Which way is UP?!
Unlike the standard XY coordinate system of 2D games where the upper left corner of the screen is (0,0) , the 3D game world positions the XY axes on the CENTER of the screen. The Z-direction is oriented as forward (+) and backward (-). This can be confusing to 2D coders since Z is typically verticke UP & DOWN. When you place or move an object in your 3D world it is easy to see this XYZ relationship, BUT once you start moving a CAMERA things can get disorienting pretty quickly.
Placing an object in 3D space has more variety than just an x,y,z position. You can also TURN any object (even the camera!) about each of the X, Y & Z axes. Turning about the X is called PITCH, Y is YAW and Z is ROLL, just like if you were flying an airplane (see diagram). These turns are measured in degrees (0-360). Don't worry though if you forget, once you run your game and see something turn the wrong way you can just change the code and try it again until you get it right.
; Insert future code HERE! i.e. constants, variables, functions
; The MAIN GAME LOOP Keeps repeating While you do NOT press ESCape
While Not KeyHit( escape_key )
|Global escape_key = 1
Global screen_width = 640, screen_height = 480
Graphics3D screen_width, screen_height, 16, 2
|Change escape_key = 1 to escape_key = 28
Now you have to press the ENTER key to stop your program!
Change Global screen_width = 640, screen_height = 480
to Global screen_width = 320, screen_height = 240
Change Graphics3D screen_width, screen_height, 16, 2
to Graphics3D screen_width, screen_height, 16, 1
Time for FULLSCREEN!
|Undo the changes you made...|
|SetBuffer BackBuffer() . . . goes with Flip|
| light1 = CreateLight( 2 )
cam1 = CreateCamera()
CameraViewport cam1, 0, 0, screen_width, screen_height
PositionEntity cube1, -2, -2, 10
texture1 = LoadTexture("water.jpg")
EntityTexture cube1, texture1
Cool huh?! Try adding your own 256 x 256 graphic in the folder and applying it to an object!
After PositionEntity cube1, -2, -2, 10
PositionEntity cone1, 4, -2, 10
Try CreateSphere(), CreatePlane(), CreateCylinder()
After PositionEntity cone1, 4, -2, 10
EntityColor cone1, 255, 0, 0
EntityAlpha cone1, .2
RotateEntity cone1, 0, 0, 90
ScaleEntity cone1, .5, 2, .5
Now what happened?!
The cone changed red, became see thru, rotated and got long and skinny!
Most paint programs will give you the 3 "RGB" numbers for any color shade you like!
The Alpha "Transparency" can vary between 0 (Invisible) and 1 (Solid)
Rotations on any of the X,Y, and Z axis can vary from 0 to 360 degrees
Scale can range from .001 up to 1000+
|While Not KeyHit( escape_key ) , goes with Wend|
| Text 50,50,"Hello
|Change Text 50,50,"Hello
to Text 50,50,"Something Else "
|Create a scene with several different primitives repositioned, scaled, and textured to make a whole new world.|