Hey there evryone, I downloaded harggood's world maker and i got it to load a world into my DBP program heres the code:
sync on
sync rate 30
hide mouse
autocam off
gosub worldload
make object sphere 1,3
position object 1,x=info(32),y=info(33),z=info(34)
do
If Upkey()=1
Move Object 1,2
endif
If Downkey()=1
Move Object 1,-2
endif
If Leftkey()=1
Dec a#,2
endif
If Rightkey()=1
Inc a#,2
endif
yrotate object 1,a#
posx#=cos(270-a#) * 30 + object position x(1)
posz#=sin(270-a#) * 30 + object position z(1)
Position Camera posx#,object position y(1)+6,posz#
Point Camera object position x(1),object position y(1)+6,object position z(1)
ypos#=object position y(1)
sync
Loop
rem include this in your program
rem gosub worldload to load first
rem use these in the game
rem entry point x=info(32),y=info(33),z=info(34)
rem hotpoint 1. x=info(35),y=info(36),z=info(37)
rem hotpoint 2. x=info(38),y=info(39),z=info(40)
rem hotpoint 3. x=info(41),y=info(42),z=info(43)
rem uses image number 325
worldload:
set normalization on
dim name$(525)
dim map(500,9)
dim info(60)
dim htmap(100,100)
dim texmap(100,100)
rem get the files
homedir$=get dir$()
set dir "C:Program FilesworldmakerNew Foldermaps"
rem loading the arrays for this world
load array "first",name$(0)
load array name$(505),info(0)
load array name$(506),map(0)
load array name$(507),htmap(0,0)
load array name$(508),texmap(0)
mx#=val(name$(511)):my#=val(name$(512)):mz#=val(name$(513))
matnum=int(val(name$(510)))
set dir homedir$
set camera range 10,9000
set light range 0,9000
rem sky and clouds
htx=info(1)*info(3)
htz=info(2)*info(3)
if info(46)=0 then info(46)=10000
make object sphere 599,info(46)
position object 599,mx#+int(htx*0.5),0,mz#+int(htz*0.5)
set object 599,1,1,0,0,0,info(20),0
set dir homedir$
set dir "C:Program FilesworldmakerNew Foldersky"
load image name$(516),21
set dir homedir$
texture object 599,21
if info(13)=1
make object sphere 598,0.8*info(46)
position object 598,mx#+int(htx*0.5),0,mz#+int(htz*0.5)
set object 598,1,1,0,0,0,info(20),0
set dir homedir$
set dir "C:Program FilesworldmakerNew Foldersky"
load image name$(517),22
set dir homedir$
texture object 598,22
show object 598
set alpha mapping on 598,50
endif
rem end sky and clouds
rem texturing the matrix
name$(502)=name$(502)
tilx=info(1)
tilz=info(2)
nt=info(1)*info(2)
set dir "C:Program FilesworldmakerNew Foldermedia"
rem tile the single image
if info(25)=0 then info(25)=1
rem load texture map
if file exist(name$(502))=1 and info(26)<2 then load image name$(502),325
set dir homedir$
make matrix matnum,htx,htz,info(1),info(2)
position matrix matnum,mx#,my#,mz#
prepare matrix texture matnum,325,1,1
set matrix trim matnum,val(name$(503)),val(name$(504))
set matrix matnum,0,info(44),1,2,1,1,1
update matrix matnum
rem set heights
nt=info(1)*info(2)
for t=1 to nt
for x=0 to info(1)
for z=0 to info(2)
set matrix height matnum,x,z,htmap(x,z)
next z
next x
next t
rem set individual textures
for x=0 to info(1)-1
for z=0 to info(2)-1
set matrix tile matnum,x,z,texmap(x,z)
next x
next z
set matrix texture matnum,0,1
update matrix matnum
rem set light 0
set directional light 0,info(9),info(10),Info(11)
color light 0,info(6),info(7),info(8)
set ambient light info(5)
color ambient light rgb(info(27),info(28),info(29))
fog on
fog distance info(14)
fog color rgb(info(16),info(17),info(18))
set normalization on
rem calculate normals
update matrix matnum
rem undims the arrays you don't need anymore
undim name$(525)
undim map(500,9)
undim htmap(100,100)
undim texmap(100,100)
return
I was wondering how to get my sphere above the ground. I know i have to make the sphere's y position equal the hieght of the ground, but im not sure how to do that.
please help.
oh ya... here is a screenshot of what is happening. please be paitient with it, it is a big picture, but it is kinda the only way i could describe what is happening