Ah, yea, forgot to try it. Give me a min.
Ok, DBC and DBP handle the DOT command differently. I'll just fix that...
Well, now it kind of works, but not so well...
Theres two ways out of this, either I continue trying to convert the code, or you download the 100 day DBP demo(which rocks by the way.).
Ok, just a small rotation issue and its ready...
Well, it kinda works, but you can't see my textures right
Please Download the DBP demo.
http://files.thegamecreators.com/darkbasicprofessional/trial/darkbasic_professional_compo2004_trial.zip
For DBC, not DBP.
input "Choose First Person(1) or Third Person(2): ",cameramode
if cameramode=0 then cameramode=1
sync on
sync rate 30
`set up lights and stuff
set ambient light 5
`set game stats
linesight=500
`player
make object cube 1,5
color object 1,RGB(0,0,225)
position object 1,0,5,0
`player fog
for a = 0 to 2
make object sphere 20+a,10*a-100
color object 20+a,RGB(200,200,200)
`set object 20+a,1,1,1,0,1,1,1
ghost object on 20+a
next a
`World
`Land
make object plain 100,1000,1000
xrotate object 100,90
`Water
make object plain 101,2000,2000
xrotate object 101,90
position object 101,0,-100,0
`Texture ground
ink rgb(0,100+rnd(155),0),rgb(0,0,0)
for x=1 to 32
for y=1 to 32
dot x, y
next y
next x
get image 1,1,1,32,32
texture object 100,1
SCALE OBJECT TEXTURE 100, 20, 20
`Texture water
ink rgb(0,0,100+rnd(155)),rgb(0,0,0)
for x=1 to 32
for y=1 to 32
dot x, y
next y
next x
get image 2,1,1,32,32
texture object 101,2
SCALE OBJECT TEXTURE 101, 10, 10
`world objects
`Trees
for a = 200 to 300
make object cone a,20
position object a,-500+rnd(1000),11,-500+rnd(1000)
color object a,RGB(0,200,0)
next a
`Texture trees
ink rgb(0,200+rnd(55),0),rgb(0,0,0)
for x=1 to 10
for y=1 to 10
dot x, y
next y
next x
get image 3,1,1,10,10
for a = 200 to 300
texture object a,3
SCALE OBJECT TEXTURE a, 2, 2
next a
`Buildings
MakeDoor(301,20,0,20)
`BEGIN LOOP********************************************************************************
do
set cursor 10,10
print screen fps()
`Switch mapmode
if shiftkey()=1
mapmode=1
else
mapmode=0
endif
if mapmode=1
if upkey()=1
yrotate object 1,curveangle(360,object angle y(1),10)
move object 1,1
endif
if downkey()=1
yrotate object 1,curveangle(180,object angle y(1),10)
move object 1,1
endif
if leftkey()=1
yrotate object 1,curveangle(270,object angle y(1),10)
move object 1,1
endif
if rightkey()=1
yrotate object 1,curveangle(90,object angle y(1),10)
move object 1,1
endif
else
if upkey()=1
move object 1,1
endif
if downkey()=1
move object 1,-1
endif
if leftkey()=1
yrotate object 1,curveangle(object angle y(1),object angle y(1)-3,10000)
endif
if rightkey()=1
yrotate object 1,curveangle(object angle y(1),object angle y(1)+3,10000)
endif
endif
if mapmode=0
`Position the camera
if cameramode=2
position camera object position x(1),object position y(1)+10,object position z(1)
set camera to object orientation 1
move camera -20
endif
if cameramode=1
position camera object position x(1),object position y(1),object position z(1)
set camera to object orientation 1
endif
else
`Position the camera
position camera object position x(1),object position y(1)+1000,object position z(1)-30
point camera object position x(1),object position y(1),object position z(1)
endif
`Gosubs
gosub WaterMovement
gosub FogMovement
gosub LineOfSight
sync
loop
`END OF LOOP******************************************************************************
LineOfSight:
for a = 200 to 300
if object exist(a)
if Object position x(1)=<Object position x(a)+linesight
if Object position x(1)=>Object position x(a)-linesight
if Object position y(1)=<Object position y(a)+linesight
if Object position y(1)=>Object position y(a)-linesight
if Object position z(1)=<Object position z(a)+linesight
if Object position z(1)=>Object position z(a)-linesight
show object a
endif
endif
endif
endif
endif
endif
if Object position x(1)=>Object position x(a)+linesight
hide object a
endif
if Object position x(1)=<Object position x(a)-linesight
hide object a
endif
if Object position y(1)=>Object position y(a)+linesight
hide object a
endif
if Object position y(1)=<Object position y(a)-linesight
hide object a
endif
if Object position z(1)=>Object position z(a)+linesight
hide object a
endif
if Object position z(1)=<Object position z(a)-linesight
hide object a
endif
endif
next a
Return
WaterMovement:
position object 101,object position x(1),object position y(1)-100,object position z(1)
scroll object texture 101,0.001,0.001
Return
FogMovement:
for a = 20 to 22
position object a,object position x(1),object position y(1),object position z(1)
next a
Return
function MakeDoor(objsnum,x,y,z)
make object cube objsnum, 10
make object cube objsnum+1, 10
make object cube objsnum+2, 10
make object cube objsnum+3, 10
color object objsnum,RGB(120,100,50)
color object objsnum+1,RGB(120,100,50)
color object objsnum+2,RGB(120,100,50)
color object objsnum+3,RGB(120,100,50)
scale object objsnum,10,100,100
scale object objsnum+1,10,100,100
scale object objsnum+2,100,100,10
scale object objsnum+3,100,100,10
position object objsnum,x+5,y+5,z
position object objsnum+1,x-5,y+5,z
position object objsnum+2,x,y+5,z+5
xrotate object objsnum+3,270
position object objsnum+3,x,y+10,z
endfunction
Infra-Dark
Bring the 20 liners back!
#coding, like coding, but with a #