Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / DBPro Tutorial 6 Huge Dungeons

Author
Message
Smurf
21
Years of Service
User Offline
Joined: 26th May 2003
Location:
Posted: 27th May 2003 10:19
Just lil help maybe?
we all know the one they give us works, but i am trying to change the camara styling to add strafing... and running into hell ...
i did this, but then relised its looking for a matix that isnt there.
***********
` #######################################################################
` DarkBasic Dungeon by Hubdule
` Shows huge dungeons
` (c) by Color Arts 2002
` #######################################################################

`set display mode 800,600,16
sync on
sync rate 50
hide mouse

backcolor=rgb(0,0,0)



backdrop on
color backdrop backcolor
cls
` Attention ... This value is the size of the map ! change it to fit your map file
mapsize=512
dim map$(mapsize,mapsize)

maxcubes=16
cubesize=200
collisionstep=int(cubesize/10)

fog on
fog color backcolor
fog distance (int(maxcubes)*cubesize)
set camera range 1,(maxcubes*cubesize)

` Current map
loadmap("media/dungeon.map",mapsize)
autocam off

load image "media/wall2.jpg",1
load image "media/ground.jpg",2
load image "media/wall.jpg",3

` Wall … you can change the walls to other objects J
for i=1 to maxcubes*maxcubes
make object cube 100+i,cubesize
` make object sphere 100+i,cubesize
` make object box 100+i,cubesize,cubesize*2,cubesize
` make object cone 100+i,cubesize
` make object cylinder 100+i,cubesize+((cubesize/100)*10)
texture object 100+i,1
next i

` floor
for i=1 to maxcubes*maxcubes
make object plain 10000+i,cubesize,cubesize
rotate object 10000+i,90,0,0
texture object 10000+i,2
next i

` ceiling
for i=1 to maxcubes*maxcubes
make object plain 20000+i,cubesize,cubesize
rotate object 20000+i,270,0,0
texture object 20000+i,3
next i

set ambient light 30
make light 1
make light 2
set point light 1,0,0,0
set spot light 2,45,90
color light 2,RGB(252,216,141)
color light 1,RGB(236,182,100)
color light 0,RGB(0,0,0)

` Search startpoint
for z=1 to mapsize
for x=1 to mapsize
if map$(x,z)="O"
cx=x*cubesize
cz=z*cubesize
endif
if map$(x,z)="U"
ex=x
ez=z
endif
next x
next zd
position camera cx,0,cz

oldpositionx#=camera position x()
oldpositionz#=camera position z()

randomize timer()
cls

do

OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#

CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)

Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,CameraAngleY#,10)
ZTest# = Newzvalue(Z#,CameraAngleY#,10)
If XTest#>0 and XTest#0 and ZTest#0 and XTest#0 and ZTest#0 and XTest#0 and ZTest#0 and XTest#0 and ZTest#=mapsize then curposx=mapsize
if curposz=mapsize then curposz=mapsize

` wall
if map$(int(curposx),int(curposz))="#" or map$(int(curposx),int(curposz))="S"
show object 100+zzz
position object 100+zzz,curposx*cubesize,0.0,curposz*cubesize
` Collisiondetection
if map$(int(curposx),int(curposz))="#"
if tx#>=((curposx*cubesize)-(cubesize/2))-collisionstep and tx#=((curposz*cubesize)-(cubesize/2))-collisionstep and tz#=mapsize then curposx=mapsize
if curposz=mapsize then curposz=mapsize

` wall
if map$(int(curposx),int(curposz))="#" or map$(int(curposx),int(curposz))="S"
show object 100+zzz
position object 100+zzz,curposx*cubesize,0.0,curposz*cubesize
` Collisiondetection
if map$(int(curposx),int(curposz))="#"
if tx#>=((curposx*cubesize)-(cubesize/2))-collisionstep and tx#=((curposz*cubesize)-(cubesize/2))-collisionstep and tz#
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 27th May 2003 15:06
Your code got cut off Try using the source box below the post box.

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!

Login to post a reply

Server time is: 2024-09-20 09:53:27
Your offset time is: 2024-09-20 09:53:27