Hey guys
I made a thread earlier this year for assistance on my first DBPro project, I was very happy to discover that there is a lot of helpful
people in the darkbasic community. And a special thanks to LBFN for his immense help.I've done a bit more on the game (I've been
spending my other lesiure time 3d modeling) and I've entirely redone the map, added basic water (tranparent blue plane) and
added my own weapon with reloading and sprinting (at least the animations).
Of course many of the glitches that existed before still exist now. Here's a list on what I'm yet to achieve, and hopefully with your
help I can:
Being able to walk over other objects (instead of just terrain) (note: I am using a .x mesh for my terrain)
Finding out how to use fuctions for mouse and key release (so I can zoom in and out of ironsights and change gun animations after
sprinting)
Getting some kind of collision with objects other than terrain
Getting my skysphere to move with the player
Getting lighting and shaders to work
There is of course other things but I'll cross those bridges when I come to them
So as you can see, I am an idiot who thinks he can waltz through programming. But any help will be credited. Thanks in advance
Here is the games code
Rem Project: Contact V1.4
Rem Created: Wednesday, March 30, 2011
Rem ***** Main Source File *****
sync on
sync rate 30
set camera range 1,99999
set global collision on
hide mouse
rem Choose nice font
set text font "Arial Black"
set text size 30
set image colorkey 0,0,0
load image "media\gfx\contactv4.png",12
sprite 1,0,550,12
scale sprite 1,50
load object "media\models\world original.x",20
load image "media\gfx\world.png",76
texture object 20,76
rotate object 20,0,180,0
scale object 20, 3000,2400,3000
load object "media\models\water.x", 257
load image "media\gfx\water.png",257
texture object 257,257
rotate object 257,0,180,0
position object 257, 0,-40,0
scale object 257, 3000,2400,3000
set alpha mapping on 257,255
load object "media\models\rockafella.x", 256
load image "media\gfx\terrainstone.jpg", 256
texture object 256,256
rotate object 256,0,180,0
scale object 256, 3000,2400,3000
load object "media\models\sky.x", 258
load image "media\gfx\copy of sky.jpg", 258
texture object 258,258
rotate object 258,0,180,0
scale object 258, 3000,2400,3000
set object light 258, 0
load object "media\models\cliffs.x",79
load image "media\gfx\cliffs.jpg",79
texture object 79,79
rotate object 79,0,180,0
scale object 79, 3000,2900,3000
load object "media\models\am.x",14
load image "media\gfx\sky.jpg",14
set object light 14,1
texture object 14,14
scale object 14,3000,3000,3000
position object 14,camera position x(0),camera position y(0)-150,camera position z(0)
make light 12
position light 12, camera position x(0),camera position y(0)-150,camera position z(0)
fog off
fog color rgb(100,100,100)
color backdrop rgb(50,50,50)
fog distance 5000
set ambient light 30
load music "media\music\main.wav",2
loop music 2
rem Make Gun
Load object "media\models\HUD.x",1,2
Load image "media\gfx\GUN_D2",20
Texture object 1,20
XRotate Object 1,0
Zrotate object 1, 0
Yrotate object 1,180
Fix object pivot 1
Scale object 1,600,600,600
position object 1,0,-7,8
set object frame 1,200
Lock object on 1
set object speed 1,1
loop object 1, 76,78
load sound "media\music\gunshot.wav",1
set image colorkey 0, 0, 0
load image "media\gfx\tree.png", 4
load image "media\gfx\cross09.png",96
load object "media\models\leaf tree.x", 69
texture object 69,96
scale object 69, 400, 200, 200
position object 69,406, -560,591
set alpha mapping on 69,255
load image "media\gfx\tree.png", 104
load object "media\models\leaf tree.x", 104
texture object 104,96
scale object 104, 200, 200, 200
position object 104,100, -550,500
set alpha mapping on 104,255
load image "media\gfx\grass.jpg", 77
load object "media\models\grass.x", 77
texture object 77,77
scale object 77, 3000, 3000, 3000
position object 77,-900,-700,200
set alpha mapping on 77,255
load image "media\gfx\grass.jpg", 78
load object "media\models\grass.x", 78
texture object 78,78
scale object 78, 3000, 3000, 3000
position object 78,-910,-600,100
set alpha mapping on 78,255
load image "media\gfx\grass.jpg", 81
load object "media\models\grass.x", 81
texture object 81,81
scale object 81, 3000, 3000, 3000
position object 81,-1000,-550,100
set alpha mapping on 81,255
load object "media\models\tree.x", 2
texture object 2,4
scale object 2, 1000, 1000, 1000
position object 2,-300,-700,500
load object "media\models\tree.x", 3
texture object 3,4
scale object 3, 1000, 1000, 1000
position object 3,600,-550,200
load object "media\models\tree.x", 6
texture object 6,4
scale object 6, 1000, 1000, 1000
position object 6,2000,-600,2000
load image "media\gfx\pinetreetextex.dds",91
load object "media\models\pine_tree.x", 5
texture object 5,91
scale object 5, 600, 600, 600
position object 5,1500,-670,3000
set alpha mapping on 5,255
load object "media\models\pine_tree.x", 72
texture object 72,91
scale object 72, 600, 600, 600
position object 72,400,-830,2000
set alpha mapping on 72,255
load object "media\models\pine_tree.x", 101
texture object 101,91
scale object 101, 600, 600, 600
position object 101,-2649, -700,589
set alpha mapping on 101,255
load object "media\models\pine_tree.x", 102
texture object 102,91
scale object 102, 600, 600, 600
position object 102,2649, -750,-589
set alpha mapping on 102,255
load object "media\models\pine_tree.x", 73
texture object 73,91
scale object 73, 600, 600, 600
position object 73,-700,-550,1000
set alpha mapping on 73,255
load object "media\models\garage.x",117
load image "media\gfx\garage.tga",117
texture object 117,117
position object 117, 1163,-630,1509
scale object 117,1,1,1
load image "media\gfx\crosshair.png",12
sprite 12,485,300,12
make light 1
make light 2
make light 3
position light 1,200,500,1
set light range 1,100000
show light 1
set point light 1,300,500,50
FireShotDelay = 0
Aimdownsight = 0
rem Main
do
if mouseclick() = 1 and timer() > FireShotDelay
set object speed 1,10
play object 1, 76,78 : // plug in your anim frames
if sound playing(1) = 1 then stop sound 1
play sound 1
FireShotDelay = timer() + 100
endif
if mouseclick() = 2 and timer() > Aimdownsight
position object 1,0,-7,8
set object speed 1,50
play object 1, 207,210
set camera fov zoom#+40
ENDIF
if shiftkey() = 1 and timer() > FireShotDelay
set object speed 1,10
loop object 1, 586,604 : // plug in your anim frames
FireShotDelay = timer() + 100
endif
if controlkey() = 1 and timer() > FireShotDelay
set object speed 1,60
play object 1,88,137 : // plug in your anim frames
FireShotDelay = timer() + 100
endif
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)
`
cx#=camera position x() : cz#=camera position z()
Rem Control input for camera
`move forwards
If keystate(17)=1
cX# = Newxvalue(cX#,CameraAngleY#,10)
cZ# = Newzvalue(cZ#,CameraAngleY#,10)
Endif
`move backwards
If keystate(31)=1
cX# = Newxvalue(cX#,Wrapvalue(CameraAngleY#-180),10)
cZ# = Newzvalue(cZ#,Wrapvalue(CameraAngleY#-180),10)
Endif
`move left
If keystate(30)=1
cX# = Newxvalue(cX#,Wrapvalue(CameraAngleY#-90),10)
cZ# = Newzvalue(cZ#,Wrapvalue(CameraAngleY#-90),10)
Endif
`move right
If keystate(32)=1
cX# = Newxvalue(cX#,Wrapvalue(CameraAngleY#+90),10)
cZ# = Newzvalue(cZ#,Wrapvalue(CameraAngleY#+90),10)
Endif
`mouse movement
Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)
position camera cx#,1100-intersect object(20,cx#,1000,cz#,cx#,-1000,cz#),cz#
camx = camera position x (0)
camy = camera position y (0)
camz = camera position z (0)
cx#=camera position x() : cz#=camera position z()
print "demo",100,100
rem Debug
if keystate(41)=1
set cursor 0,0 : print "FPS: ";screen fps():print "X Position : " ,camx:print "Y Position : " , camy:print "Z Position : " , camz
endif
rem Update screen
sync
rem End loop
loop
end
and here's a screenshot
and here's the dl
http://www.mediafire.com/?lv0269s2kidhd27
Poloflece