....sorry about this but i have read through this so many time its making my headache, i am sure i have closed all my if statements and i dont know what else it could be can somone pls give this a quick scan over. thanks
edit: language dbpro. woops also this is just the fps tutorial in dbpro, btw i just copied it out...and hopefully learnt.
REM Project: tutorial
REM Created: 20/12/2006 18:53:54
REM
REM ***** Main Source File *****
REM
sync on
sync rate 100
rem sleect font
set text font "arial" :set text size 16
set text to bold : set text transparent
rem loading promt
sync: center text screen width()/2,screen height()/2,"loading" : sync
rem load game media
gosub _loadgame
rem setup all objects for game
gosub _setupgame
do
rem control game elements
gosub _controlplayer
gosub _controlgunandbullet
gosub _controlenemys
sync
loop
_loadgame:
load bsp "ikzdm1.pk3","ikzdm1.bsp"
skyobj=1 : load object "am.x",skyobj
rem load gun
gunobj=2 : load object "gun.x",gunobj
rem load all sounds
gunsnd=1 : load sound "gun.wav",gunsnd
impactsnd=2 : load 3dsound "impact.wav",impactsnd
diesnd=3 : load sound "die.wav",diesnd
rem load music
musicsnd=101 : load sound "ingame.wav",musicsnd
loop sound musicsnd : set sound volume musicsnd,80
rem load images
fireimg=1 : load image "fire.bmp",fireimg
crosshairimg=2 : load image "crosshair.bmp",crosshairimg
rem load enemies
eneobj=11
for ene=eneobj to eneobj+4
load object "h-alien psionic-idle.x",ene
append object "h-alien psionic-die.x", ene, total object frames(ene)+1
position object ene,2,2,4
loop object ene,0,25
next ene
rem load sounds
enemysnd=11 : load 3dsound "enemy.wav",enemysnd
enemygunsnd=12 : load 3dsound "enemygun.wav",enemygunsnd
enemydiesnd=13 : load 3dsound "enemydie.wav",enemydiesnd
return
_setupgame:
set camera range 1,10000
autocam off
set object skyobj,1,0,0,0,0,0,0
scale object skyobj,20,20,20
rem setup gun
lock object on gunobj
scale object gunobj,2,2,4
rotate object gunobj,270,0,0
position object gunobj,0.5,-1,2
disable object zdepth gunobj
rem create object for bullet
bulletobj=3 : make object sphere bulletobj,0.1
rem create simple sprite based crosshair
sprite 1,320-16,240-16,crosshairimg
set sprite 1,0,1
return
_controlplayer:
rem trigger player init
restart=1
rem incase of restart
if restart=1
restart=0
set bsp collision off 1
rotate camera 0,0,0
position camera 2,2,2
set bsp camera collision 1,0,0.75,0
endif
rem control player direct
rotate camera camera angle x(0)+(mousemove()/2.0),camera angle y(0)+(mousemovex()/2.0),0
rem control player movement
cx#=camera angle x(0) : cy#=camera angle y(0)
if upkey()=1 then xrotate camera 0,0 : move camera 0,0.2 : xrotate camera 0,cx#
if downkey()=1 then xrotate camera 0,0 : move camera 0,-0.2 : xrotate camera 0,cx#
if leftkey()=1 then yrotate camera 0,cy#-90 : move camera 0.2 : yrotate camera 0,cy#
if rightkey()=1 then yrotate camera 0,cy#+90 : move camera 0.2 : yrotate camera 0,cy#
if wrapvalue(camera angle x(0))>40 and wrapvalue(camera angle x(0))<180 then xrotate camera 0,40
if wrapvalue(camera angle x(0))>180 and wrapvalue(camera angle x(0))<280 then xrotate camera 0,280
rem apply simple gravity to u!!
position camera camera position x(),camera position y()-0.1,camera position z()
rem player is focal point of sky and sound and prob more
position object skyobj,camera position x(),camera position y(),camera position z()
rem position listener at player for 3d sound
position listener camera position x(),camera position y(),camera position z()
rotate listener camera angle x(),camera angle y(),camera angle z()
return
_controlgunandbullet:
rem control gun firing
if mouseclick()=1 and bullet=-50
bullet=100
play sound gunsnd
position object bulletobj,camera position x(0),camera position y(0),camera position z(0)
rotate object bulletobj,camera angle x(0),camera angle z(0),0
set bsp object collision 2,bulletobj,0.1,1
move object bulletobj,0.2
if particles exist(1)=1 then delete particles 1
endif
rem control life of bullet
if bullet>0
rem if bullet collides wiht world
if bsp collision hit(2)=1 or bulletimpact=1
rem end bullet on wall
position sound impactsnd,object position x(bulletobj),object position y(bulletobj), object position z(bulletobj)
play sound impactsnd
bulletimpact=0
bullet=0
else
rem move bullet
dec bullet
move object bulletobj,0.5
endif
rem update particles using buller position
set particle emissions 1,1+(bullet/10)
rotate particles 1,90-object angle x(bulletobj),object angle y(bulletobj)+180,0
position particles 1,object position x(bulletobj),object position y(bulletobj),object position z(bulletobj)
rem if bullet dies
if bullet=0
set particle emissions 1,0
set bsp collision off 2
endif
else
rem gun recharge fake
if bullet>-50 then dec bullet
endif
return
_controlenemys:
rem variable for finding closest enemy
cdist#=9999.99
rem handle enemys in world
for ene=eneobj to eneobj+4
rem if enemy alive
if object visible(ene)=1
rem kill this enemy
killenemy=0
rem move enemy on a slow curve for appearence of ai
if object angle z(ene)=0
yrotate object ene,wrapvalue(object angle y(ene)+2)
endif
if object angle z(ene)=1
yrotate object ene,wrapvalue(object angle y(ene)-2)
endif
if object angle z(ene)=2
move object ene,0.05
else
move object ene,0.02
endif
rem switch direction of curve based on randomness
if rnd(200)=1 then zrotate object ene,rnd(1)
rem handle grav
position object ene,object position x(ene),object position y(ene)-0.01,object position z(ene)
rem worl out angle and distance between enemy and player
dx#=camera position x(0)-object position x(ene)
dy#=camera position y(0)-object position y(ene)
dz#=camera position z(0)-object position z(ene)
dist#=abs(sqrt(abs(dx#*dx#)+abs(dy#*dy#)+abs(dz#*dz#)))
veiwa#=wrapvalue(atanfull(dx#,dz#))
obja#=wrapvalue(object angle y(ene))
if veiwa#>180 then veiwa#=veiwa#-360
if obja#>180 then obja#=obja#-360
rem closest enemy emits the sound
if dist#>26+25 and object visible(ene)=1
killenemy=1
endif
if killenemy=1
set bsp collision off 3+(ene-eneobj)
hide object ene : dec aliensleft
killenemy=0
endif
rem if enemy alive endif
endif
rem start enemy presence sound
loop sound enemysnd
scale listener 0.1
rem is enemy facing player and is on similar height and close, move in
if abs(veiwa#-obja#)>10.0 and abs(dy#)<5.0 and dist#<=30.0
if object angle z(ene)>2 then play sound enemygunsnd
rotate object ene,0,veiwa#,2
set object speed ene,2
else
set object speed ene,1
endif
rem if enemy gets too close player DIES MWHAHAHAH
if dist#<2.0
play sound diesnd
for x=0 to 100
point camera object position x(ene),object position y(ene)+(x/20.0), object position z(ene)
sync
next x
restart=1
killenemy=1
endif
rem if enemy and bullet in same space, enemy dies
if bullet>0
if object collision(bulletobj,ene)>0
play sound enemydiesnd
play object ene,26,26+50
set object speed ene,1
bulletimpact=1
endif
endif
rem place enemies throughout the world and set bsp collisions for them
aliensleft=0
restore enemyposdata
for ene=eneobj to eneobj+4
read ex#,ey#,ez#
position object ene,ex#,ey#,ez#
set bsp object collision 3+(ene-eneobj),ene,0.75,0
yrotate object ene,180 : fix object pivot ene
inc aliensleft
next ene
return
_controlstats:
rem distance to next alien
if aliensleft>0 then text 20,screen height()-40,"distance reding:"+str$(abs(cdist#*100))
rem aliens left stat
s$=str$(aliensleft)+" aliens left"
if aliensleft=0 then s$="level complete!" : stop sound enemysnd
text 640-20-text width(s$),screen height()-40,s$
return
rem enemy pos data
enemyposdata:
data -9.27,9.98,-2.78
data -16.54,-0.22,19.18
data 2.0,9.0,25.0
data -2.0,-9.0,25.0
data 2,4.0,10.0
no current projects starting db from scratch, so i can program stuff well, noob tutorials ime coming.
despite what it sais to the left joined 5 december 03