Wow this is turning out to be Dark Basic 101 for me I love it
, The poeple at Game Creators should thank you Mr. AI , becouse with your help on getting started with programming, as soon as I get paid I'm going to buy Dark Basic Pro and some other software to get going. When you said about puting your game on paper that is no joke when taking VB that help me out a lot, thats what I did when I first started this game. This is the list that I made.
1. Make a playing field
2. Put arrows as the Controls for moving
3. Put player on the map "the Tank" and move on map
4. Get tank to fire it's 25mm gun; add sound, smoke and explosion if it did hit anything.
5. Now put in enemy tank get it where if shell hits enemy it will explode enemy remove from map.
6. Put a AI for enemy tank, but not Mr. AI in tank
have tank go after player.
This should give me a basic game engine
Now add a game, menu, trees, build.
Is this how you would put it on paper or is this a bad way to do it? If it is I can always start over.
I put more rem statements in the code to explain it better for future games that I make. Please take a look at and it and see if ok
when you got the time.
rem game was made with the big help from the tutorial on the "monster hunt" and people
rem at the game creators forum. Forumnames are as follow: Dodo,Mr AI,
rem Thank you all for the help in this :-)
sync On
rem constant screen refresh rate
Sync Rate 27
Backdrop on
rem sets the view distance of the camera
Set camera range 1,3000
Fog on
Fog distance 3000
Fog color RGB(128,128,128)
Color Backdrop RGB(128,128,128)
Rem makes the dimensions of the playing field for the game in this case rolling hills
Make matrix 1,10000,10000,20,20
Rem texture matrix
Load image "g:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Marty\grass09.bmp",1
rem 1 = number of the matrix to make; 1 = image we will use for the matrix texture; 1,1 = number of individual sections we wish to devide the texture into
Prepare matrix texture 1,1,1,1
rem sets matrix to a specific height and a specific image tile number
Fill matrix 1,0,1
Rem Randomize the matrix a random height between 1 and the next height value given
randomize matrix 1,125
update matrix 1
Rem Make player spawn
Load object "g:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Marty\tank.x",10
Scale object 10,1000,1000,1000
texture object 10,2
position object 10,100,0,100
Rem Make shell
Make Object Sphere 2,2
rem hide sphere untill we need it to be seening
Hide Object 2
rem ladd smoke for shell particles
Load Image "g:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Marty\037005560.jpg",2
For x = 0 to 9
Make object plain x+10,5,5
Texture object x+10,2
rem set attributes of an object; 1 = object is displayed, 0 = transparency to be shown, 0 = both sides to be rendered
Set object x+10,1,0,0
rem make the object transparent
Ghost object on x+10
rem loop for x to count up to 9
Next x
rem intialize particle counter an index of which particle needs to be affected next.
Pn=10
rem sound
Load 3Dsound "g:\Program Files\The Game Creators\Dark Basic Professional Trial\Projects\Marty\gunshot5.wav",2
Rem Main loop
Do
Rem Store Object angle
AngleY# = object angle Y(10)
Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,AngleY#,20)
ZTest# = Newzvalue(Z#,AngleY#,20)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
Move object 10,10
Endif
Endif
If Leftkey()=1 then Yrotate object 10,Wrapvalue(AngleY#-5)
If Rightkey()=1 then Yrotate object 10,Wrapvalue(AngleY#+5)
X# = Object position x(10)
Z# = Object position z(10)
Y# = Get Ground Height(1,X#,Z#)
Position object 10,X#,Y#+12.5,Z#
CameraZ# = Newzvalue(Z#,AngleY#-180,100)
CameraX# = Newxvalue(X#,AngleY#-180,100)
rem how high the camera will be from ground
Position camera CameraX#,Y#+30,CameraZ#
Point camera X#,Y#+32,Z#
Rem Position Listener
Position Listener X#,Y#+50,Z#
Rotate Listener 0,cAY#,0
Rem Shoot shell
rem looks to see if left mouse button has been click and if there is a shell still out there
if Mouseclick()=1 and ShellLife=0
rem this pasition the shell with the tank with the x#,y#,and z# that are stored in the varibles that are in memory
Position object 2,X#,Y#+20,Z#
rem points the object in the same direction as the camera
Set object to camera orientation 2
rem this is how long the shell will be render on the screen
ShellLife = 30
rem now the object cam be seen in this case the shell
show object 2
rem keeps playing sound untill shelllife = 0
Loop sound 2
Endif
If ShellLife > 0
Dec ShellLife
Move object 2,20
bX#=Object position X(2)
bY#=Object position Y(2)
bZ#=Object position Z(2)
Position sound 2,bX#,bY#,bZ#
rem increment the "Pn" variable to move to the next particle object
inc Pn
rem see if it has gone out of the bounds if so go back to 10
if Pn=20 then Pn=10
rem scale of the particle object to its original size
Scale object Pn,100,100,100
rem point the particle object at the camera and rotate the object
Position object Pn,bX#,bY#,bZ#
point object Pn,X#,Y#,Z#
Zrotate object Pn,rnd(180)
for x = 1 to 10
rem don't know to
scale object int((Wrapvalue((Pn-9+x)*36))/36)+10,100+x*25,100+x*25,100+x*25
set cursor 10,10
print int((Wrapvalue((Pn+x)*36))/36)+10
next x
if ShellLife = 0
Hide object 2
stop sound 2
endif
Endif
Rem Refresh Screen
Sync
Loop
This code will not work yet problem with the smoke particles I get an; runtime error 707 - object already exists at line 43
Make object plain x+10,5,5
This is part 3.7 of the tutorial in MH. Give me a day and see if I can get it, if maybe you or other person can help with.
WindowsXP Professional, AMD Athlon 2.500+ GHz CPU, 512 MB of RAM, GEForce2 MX 64mb of RAM. Let the Game's Begin...