@Ben
Welcome, its always nice to see more people interested.
I will take a look at your code today, see what I can. If you have a version that doesn't use media, that would be great because then I can see what the code does/doesn't do vs. what it is supposed to do.
Fortunately I have sparky's so no worries there.
Right now the project is kinda slowed, but you can check in there and see if you can help.
[EDIT]
Haven't gotten into the real meat of the program yet, but I did do a little tidying up.
Changes:
Indentations-Indent subroutines and any loops/if-thens you have. This makes it MUCH easier to read since you can visually see where things stop and start.
: vs ; - It seems like you have some kind of experience C or a similar language. In DBC, there is no need to end lines of code with a ; . To combine 2+ lines of code into a single line, you should use the : symbol as opposed to the ; symbol. To clarify: the semi-colon is used with text based commands (such as PRINT) to keep the cursor on the same line rather than dropping to the next line for the next line of text.
Single-lines of code w/ multiple commands- Personally, I avoid putting more than one line of code onto a single line in my programs. Sometimes, it isn't a problem (such as putting 3 lines that get an object's position onto a single line). However, if two lines have nothing to do with each other, don't put them together, otherwise it gets cluttered and its hard to know whats going on.
Variable Names- Sorry, I get nitpicky about this kind of thing. Your variables should always be self descriptive. That is to say, if a variable is for a display, don't call it "d$". Call it "display$". d$ could be anything, whereas when you see "display$" you know it has something to do with a display.
Commenting-We pretty much always drill this into new members, since it usually isn't intuitive. Always comment your code thoroughly. If there is a line that someone can pick and not know what it does and how its doing it, you haven't commented enough. Your comments do 2 things: 1) They tell others what you are thinking and why you are doing things the way you are. 2) They tell YOU what you WERE thinking, so that later when you revisit your program you won't scratch your head thinking "why did I do it that way? What is that for?"
Your tidied up code (I put placeholder objects in there so that I could compile it, but your code is still there just commented out)
sync on
sync rate 60
make object sphere 2,2.5 : position object 2,0,21,0 : fall#=0 : hide object 2
make object cube 1,5 : sc_setupobject 1,1,0 : set object cull 1,0
`load object "size.3ds",1: sc_setupobject 1,1,0:set object cull 1,0:
`load object "dragon.3ds",3
make object box 3,10,20,30
` load image "DTEXT.BMP",1: texture object 3,1:
` load image "dbump.bmp",2: set bump mapping on 3,2:
`set object cull 3,0; set ambient light 50; set object smoothing 3,100;
`make object sphere 5,2.5;position object 5,0,21,0; make mesh from object 1,5; add limb 5,1,1; add limb 5,2,1; link limb 5,1,2;
make object box 13,1,5,10
`load object "p90.3ds",13;
position object 13,0,21,0
do
b#=b#+.01
print b#
scale object 13,(13-b#)*100,100,100
`rotate limb 5,2,b,b,b
print screen fps()
qq#=qq#+mousemovey():ww#=ww#+mousemovex()
q#=qq#/3;w#=ww#/3
if q#>54 then q#=54
if q#<-55 then q#=-55
gosub movement
speed#=speed#/13
move object 2,speed#
rotate object 2,q#,w#,0
sc_setupobject 2,1,2
gosub falsephysics
`camera
position camera object position x(2),object position y(2)+(crouch#)-2.5,object position z(2)
rotate camera q#,w#,0
sync
loop
movement:
if spacekey()=0 then spacepress=0
if spacekey()=1 and jump<-5 and spacepress=0
jump=13
endif
if jump>0
rotate object 2,270,0,0; move object 2,.7; jump=jump-1; spacepress=1
endif
speed#=0;cb=0
if keystate(17)=1
speed#=8;cb=1
rotate object 2,0,w#,0
endif
if keystate(31)=1 and cb=0
rotate object 2,0,w#-180,0;speed#=4
endif
if keystate(30)=1
if cb=1
rotate object 2,0,w#-45,0;speed#=7
else
rotate object 2,0,w#-90,0;speed#=5
endif
endif
if keystate(32)=1
if cb=1
rotate object 2,0,w#+45,0;speed#=7
else
rotate object 2,0,w#+90,0;speed#=5
endif
endif
if controlkey()=1
if crouch#>1.45
crouch#=crouch#-.2
else
crouch#=1.45; speed#=speed#/2
endif
else
if crouch#<2.75
crouch#=crouch#+.5
else
crouch#=2.75
endif
endif
if slope=1 then speed#=4
return
falsephysics:
`running into to wallz
dir#=atanfull(object position x(2)-x#,object position z(2)-z#)
tw=sc_spherecast(1,object position x(2),object position y(2)-1.25,object position z(2),newxvalue(object position x(2),dir#,.1),object position y(2)-1.26,newzvalue(object position z(2),dir#,.1),2.5,0)
if tw>0
position object 2,sc_getstaticcollisionx(),object position y(2),sc_getstaticcollisionz() : size#=1
else
size#=2.3
endif
`bumping my head "ouch"
if sc_objectcollision(1,2)=1
tc=sc_spherecast(1,object position x(2),object position y(2),object position z(2),object position x(2),object position y(2)+30,object position z(2),1.5,0)
if tc>0 then cty#=sc_getstaticcollisiony() else cty#=-8000
if crouch#<2.75 and cty#+4>object position y(2) and cty#<object position y(2)+1 then crouch#=1.45
if cty#+4>object position y(2) and cty#<object position y(2)+1
position object 2,object position x(2),y#,object position z(2)
jump=-1
endif
endif
`steep stopping
slope=0
yt=sc_raycast(1,object position x(2),object position y(2),object position z(2),object position x(2),object position y(2)-(4+crouch#+((2.3-size#)/2)),object position z(2),0)
if yt>0
ytnx#=sc_getcollisionnormalx(): ytny#=sc_getcollisionnormaly(): ytnz#=sc_getcollisionnormalz()
if ytny#<.7
point object 2,ytnx#+object position x(2),ytny#+object position y(2),ytnz#+object position z(2)
pitch object DOWN 2,90; move object 2,.7; slope=1
endif
endif
print sc_getcollisionnormaly()
x#=object position x(2) : y#=object position y(2) : z#=object position z(2)
`falling or standing or landing
t=sc_spherecast(1,x#,y#-1.25,z#,x#,y#-300,z#,size#,0)
if t>0 then cy#=sc_getstaticcollisiony() else cy#=-9000
if y#>cy#+(crouch#+(2.3-size#))
fall#=fall#+.039;point object 2,x#,-30,z#; move object 2,fall#
else
position object 2,x#,cy#+(crouch#+(2.3-size#)),z#
if jump>-6 then jump=jump-1
fall#=0
if jump>-1 then jump=-1;
endif
return
`b#=sqrt((sc_getstaticcollisionx()-object position x(2))^2+(sc_getstaticcollisionz()-object position z(2))^2)
`bx#=((sc_getstaticcollisionx()-object position x(2))/b#)*2.5;bz#=((sc_getstaticcollisionz()-object position z(2))/b#)*2.5
Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose