The First Program: Jumping Cone!

All right, now you will be able to see what a simple 3D program can do! Basically, this program is just a simple cone that jumps up and down. To play, either run demo01-01.exe from the CD or compile the code.

To compile the code yourself, you need to find demo01-01.bb on the CD. After finding it, copy it to your computer and open it through the Blitz3D compiler. To open it, find the File menu on the top of the compiler and choose Open. Navigate to demo01-01.bb and press Enter. The code should now appear inside your compiler.

To actually compile, find the Program menu in Blitz3D. Select Program > Run Program, and the game will compile and run! If you get a window asking you to save the file, choose a directory to save it in or just press Cancel, and the program will run. You have just compiled your first program!

Feel free to examine the code; although it may seem very weird and hard to understand now, you will soon be able to figure out this code easily.

Table 1.3 lists the keys you will use for this game.

Table 1.3. Keys Used in Jumping Cone
KeyAction
Up ArrowSpeed up cone
Down ArrowSlow down cone
EscapeExit game

Okay, let’s actually take a look at the code. Read it, but don’t worry if some of it is hard to understand. This is the first program you have seen, and it isn’t easy. You will learn how to actually write this code throughout the book.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.249.198