Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

fireindy

fireindy Avatar

**
Official Member

114


May 2007
Well Ive been doing some game programming lately and found Dark Basic Pro.

Its a language they created to create games. Very powerful might I add.

I downloaded the trial and have been messing with it. And I got some basic movement down. In this tutorial I will show you how to do that.

hide mouse : backdrop on
color backdrop rgb(150,150,150)
set window on
set display mode 800,600,32
set window size 800,600


This is some basic setup

hide mouse: backdrop on allows you to hide the mouse and allow coloring to the backdrop

color backdrop rgb(150,150,150) colors the backdrop, using RGB values

set window on sets the game to windowed mode

set display mode 800,600,32 and set window size 800,600 sets the display properties of the game

Next thing we are going to do is create a cube and position it


make object box 1,10,10,10  : color object 1, rgb(255,0,0)
position object 1,0,0,0


Pretty easy to follow. Created an object in the shape of a cube, colored it using RGB values and the positioned it with X,Y, and Z values.

Next:
The actual program


moveleft# = 0
moveright# = 0

Do
If UPKEY()
Move Object 1,.5
EndIF
If DOWNKEY()
Move Object 1,-.5
EndIF
If LeftKEY()
moveleft# = moveleft# - .5
Rotate Object 1,0,moveleft#,0
EndIF
If RightKEY()
moveright# = moveright# + .5
Rotate Object 1,0,moveright#,0
EndIF
Loop
wait key


Self-Explanatory again. Integers in DarkBasic have a "#" sign after them.

What I do is:

Set 2 integers to the left and right values for later use

Then comes the loop: this is the main loop of the program

Check the key on press. If it is forward or back, just use the Move Object command.

If the key is left or right we use our integers.

To turn the cube, we use the Rotate Object command.

We set the integer to itself + .5 then we rotate the object using the integer.

The wait key at the end waits for any key to be pressed then closes it.

Im new to this also and I am learning. I plan on buying the real version soon so I can make more tutorials. If you have any problems, please ask me.


Last Edit: Aug 22, 2007 20:53:13 GMT by fireindy


newBookmarkLockedFalling