Not even a day has gone by and already a new set of questions have popped to my mind.
How do you patch a DB-pro file (the .exe file that is), or is that what the small .exe + .PCK file is for?
And is code written in dark-basic supposed to lagg on a computer that can play cs, quake 3 and more or is my code terrible written?
rem Initial settings
sync on : sync rate 100
backdrop off : hide mouse
rem Select font
set text font "arial" : set text size 16
set text to bold : set text transparent
rem Loading prompt
sync : center text screen width()/2,screen height()/2,"LOADING" : sync
rem Load all media for game
gosub _load_game
rem Setup all objects for game
gosub _setup_game
rem Game loop
do
rem Control game elements
gosub _control_player
gosub _control_gunandbullet
gosub _control_enemies
rem Update screen
sync
if y#=>camera position y()-0.05 and y#=<camera position y()+0.05 then air#=1 else air#=0
rem End loop
loop
rem End program
end
_control_player:
rem Control player direction
rotate camera camera angle x(0)+(mousemovey()/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 air#=1
if keystate(17)=1 then xrotate camera 0,0 : move camera 0,0.2: xrotate camera 0,cx# :up=1 else up=0
if keystate(31)=1 then xrotate camera 0,0 : move camera 0,-0.2 : xrotate camera 0,cx#:down=1 else down=0
if keystate(30)=1 then yrotate camera 0,cy#-90 : xrotate camera 0,0 : move camera 0.2 :xrotate camera 0,cx#: yrotate camera 0,cy#: left=1 else left=0
if keystate(32)=1 then yrotate camera 0,cy#+90 :xrotate camera 0,0 : move camera 0.2 :xrotate camera 0,cx#: yrotate camera 0,cy#: right=1 else right=0
else
if up=1 then xrotate camera 0,0 : move camera 0,0.2: xrotate camera 0,cx#: yrotate camera 0,cy#
if down=1 then xrotate camera 0,0 : move camera 0,-0.2 : xrotate camera 0,cx#: yrotate camera 0,cy#
if left=1 then yrotate camera 0,cy#-90 : xrotate camera 0,0 : move camera 0.2 : xrotate camera 0,cx#: yrotate camera 0,cy#
if right=1 then yrotate camera 0,cy#+90 :xrotate camera 0,0 : move camera 0.2 : xrotate camera 0,cx# : yrotate camera 0,cy#
endif
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
if spacekey()=1 and x=0 and air#=1 then x=1: x#=camera position y()
if x=1 and camera position y()=<x#+10
position camera camera position x(),camera position y()+0.2,camera position z()
else
x=0
endif
y#=camera position y()
rem Apply simple gravity to player
position camera camera position x(),camera position y()-0.1,camera position z()
rem Player is always focal point of sky
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()
rem In case 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
return
_control_gunandbullet:
return
_control_enemies:
return
_control_stats:
return
_setup_game:
rem Setup camera
set camera range 0.1,5000
autocam off
rem Setup sky model
set object SkyObj,1,0,0,0,0,0,0
scale object SkyObj,20,20,20
restart=1
return
_load_game:
rem Load BSP world and sky model
load bsp "","ikzdm1.bsp"
SkyObj=1 : load object "models\sky\am.x",SkyObj
return
It is based on the tutorialcode from the help file, no big changes except from the buggy jumping part.
One of my friends who were suposed to beta test the jumping got faced with \"an enormus lagg isue\" as he said. Any help with this is most welcome. (A few tips on how you get the fps to go up in general would also be appreciated)
Why wern't I allowed to edit my last post?
forever learning