i changed it. Landscape(terrainid).ground is NOT my id anymore. its terrain.
it is a person model.
here's my code:
Rem Project: worldeditor
Rem Created: Saturday, August 28, 2010
Rem ***** Main Source File *****
disable escapekey
`Set Up Display
Sw=screen width():Sh=screen height()
get_dx(9)
_________SET_UP_______:
sync on : sync rate 60
hide mouse
Global terrain as integer
TBM_Initialize
autocam off
type player
health# as float
actualhealth# as float
maxhealth# as float
magic# as float
actualmagic# as float
maxmagic# as float
X# as float
Y# as float
Z# as float
Speed# as float
TSpeed# as float
id as integer
endtype
type menu
id as integer
endtype
type footstep
id as integer
endtype
global texture
global detail
global ground
global loaded
global Angle1#
#constant healthtube 1
#constant healthbarleftside 2
#constant healthbarrightside 3
#constant healthbar 4
#constant playerid 5
#constant obj11 6
#constant obj22 7
#constant obj33 8
#constant healthbarid 10
#constant magicbarid 11
#constant magicbar 12
#constant footid 1
#constant footid2 2
#constant footid3 3
#constant footid4 4
#constant footid5 5
#constant footid6 6
#constant footid7 7
#constant footid8 8
#constant footid9 9
#constant effectid 1
#constant effectid2 2
#constant effectid3 3
#constant effectid4 4
#constant effectid5 5
#constant cameraid 10000
#constant cameraid2 10001
#constant cameraid3 10002
set camera range .1,500
global p111 as player
dim Object(20000) as player
Object(playerid).id=find free object(playerid,100000)
Object(effectid).id=find free effect(effectid,100000)
Object(effectid2).id=find free effect(effectid2,100000)
Object(effectid3).id=find free effect(effectid3,100000)
Object(effectid4).id=find free effect(effectid4,100000)
Object(effectid5).id=find free effect(effectid5,100000)
Object(cameraid).id=find free object(cameraid,100000)
Object(cameraid2).id=find free object(cameraid2,100000)
Object(cameraid3).id=find free object(cameraid3,100000)
`if mousex()>[img pos x] and mousex()<[img pos x+size x] and mousey()>[img pos y] and mousey()<[img pos y+size y]
Object(playerid).X# = 0.0
Object(playerid).Y# = 1.0
Object(playerid).Z# = 0.0
dim footstep1(9) as footstep
footstep1(footid).id = find free sound(footid, 100000)
footstep1(footid2).id = find free sound(footid2, 100000)
footstep1(footid3).id = find free sound(footid3, 100000)
footstep1(footid4).id = find free sound(footid4, 100000)
footstep1(footid5).id = find free sound(footid5, 100000)
footstep1(footid6).id = find free sound(footid6, 100000)
footstep1(footid7).id = find free sound(footid7, 100000)
footstep1(footid8).id = find free sound(footid8, 100000)
footstep1(footid9).id = find free sound(footid9, 100000)
LoadGame()
InitLandGen()
p1 = CreateVegetation("Objects\grass1.dbo", 6, 6, 6)
p2 = CreateVegetation("Objects\grass2.dbo", 4, 4, 4)
p3 = CreateVegetation("Objects\weed1.dbo", 4, 4, 4)
p4 = CreateVegetation("Objects\weed2.dbo", 4, 4, 4)
p5 = CreateVegetation("Objects\fern1.dbo", 4, 4, 4)
p6 = CreateVegetation("Objects\fern2.dbo", 4, 4, 4)
p7 = CreateVegetation("Objects\weed3.dbo", 1, 1, 1)
p8 = CreateVegetation("Objects\bush1.dbo", 3, 3, 3)
p9 = CreateVegetation("Objects\bush2.dbo", 3, 3, 3)
p10 = CreateVegetation("Objects\tropical1.dbo", 2, 2, 2)
p11 = CreateVegetation("Objects\rock1.dbo", 2, 2, 2)
p12 = CreateVegetation("Objects\rock2.dbo", 2, 2, 2)
p13 = CreateVegetation("Objects\reed1.dbo", 6, 6, 6)
p14 = CreateVegetation("Objects\reed2.dbo", 6, 6, 6)
p15 = CreateVegetation("Objects\scrub1.dbo", 5, 5, 5)
p16 = CreateVegetation("Objects\scrub2.dbo", 5, 5, 5)
p17 = CreateVegetation("Objects\scrub3.dbo", 5, 5, 5)
p18 = CreateVegetation("Objects\scrub4.dbo", 5, 5, 5)
p19 = CreateVegetation("Objects\mushroom1.dbo", 1, 1, 1)
p20 = CreateVegetation("Objects\mushroom2.dbo", 1, 1, 1)
p21 = CreateVegetation("Objects\lily1.dbo", 4, 4, 4)
p22 = CreateVegetation("Objects\lily2.dbo", 4, 4, 4)
p23 = CreateVegetation("Objects\skull.x", 100, 100, 100)
p24 = CreateVegetation("Objects\torso.x", 10, 10, 10)
p25 = CreateVegetation("Objects\claw sword.x", 4, 4, 4)
p26 = CreateVegetation("Objects\ottoman_helmet.x", 500, 500, 500)
p27 = CreateVegetation("Objects\rockblack.dbo", 4, 4, 4)
p28 = CreateVegetation("Objects\Celtic Cross.x", 500, 500, 500)
p29 = CreateVegetation("Objects\sago.dbo", 2, 2, 2)
remstart
i = LookUpEnv( "grassland")
if i > 0
` play sound footstep1(footid).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p1, 5900, 1)
AddVegetation(i, p2, 4000, 1)
AddVegetation(i, p3, 50, 1)
AddVegetation(i, p4, 50, 1)
CreateEnvironment(i)
Endif
i = LookUpEnv( "desert")
if i > 0
` play sound footstep1(footid1).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p10, 150, 150)
AddVegetation(i, p29, 150, 150)
CreateEnvironment(i)
Endif
i = LookUpEnv( "rock")
if i > 0
` play sound footstep1(footid2).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p11, 20, 1)
AddVegetation(i, p12, 20, 1)
CreateEnvironment(i)
Endif
i = LookUpEnv( "battlefield")
if i > 0
` play sound footstep1(footid3).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p23, 3, 1)
AddVegetation(i, p24, 2, 1)
AddVegetation(i, p25, 2, 1)
AddVegetation(i, p26, 2, 1)
AddVegetation(i, p27, 10, 2)
AddVegetation(i, p28, 5, 2)
CreateEnvironment(i)
Endif
i = LookUpEnv( "reeds")
if i > 0
` play sound footstep1(footid4).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p13, 6000, 1)
AddVegetation(i, p14, 4000, 1)
CreateEnvironment(i)
Endif
i = LookUpEnv( "scrub")
if i > 0
` play sound footstep1(footid5).id
NewEnvironment(i, 1, 0)
AddVegetation(i, p15, 3000, 2)
AddVegetation(i, p16, 2000, 2)
AddVegetation(i, p17, 2000, 2)
AddVegetation(i, p18, 3000, 2)
CreateEnvironment(i)
Endif
i = LookUpEnv( "swamp")
if i > 0
` play sound footstep1(footid6).id
NewEnvironment(i, 0, 1)
AddDoubleVegetation(i, p13, p21, 6000, 1000, 1)
AddDoubleVegetation(i, p14, p22, 4000, 1000, 1)
CreateEnvironment(i)
Endif
i = LookUpEnv( "forest")
if i > 0
` play sound footstep1(footid7).id
NewEnvironment(i, 0, 0)
AddVegetation(i, p5, 100, 1)
AddVegetation(i, p6, 100, 1)
AddVegetation(i, p7, 9000, 1)
AddVegetation(i, p8, 10, 1)
AddVegetation(i, p9, 10, 1)
AddVegetation(i, p19, 10, .1)
AddVegetation(i, p20, 10, .1)
CreateEnvironment(i)
Endif
i = LookUpEnv( "border")
if i > 0
` play sound footstep1(footid8).id
NewEnvironment(i, 1, 0)
CreateEnvironment(i)
Endif
remend
JumpToPoint("Start")
CreateCover()
UpdateSky(45)
ts as float = 0
tmp = New Vector4()
`set ambient light 100
load sound "walkl_br.wav", footstep1(footid).id
load sound "walkl_br.wav", footstep1(footid2).id
load sound "walkl_br.wav", footstep1(footid3).id
load sound "walkl_br.wav", footstep1(footid4).id
load sound "walkl_br.wav", footstep1(footid5).id
load sound "walkl_br.wav", footstep1(footid6).id
load sound "walkl_br.wav", footstep1(footid7).id
load sound "walkl_br.wav", footstep1(footid8).id
load sound "walkl_br.wav", footstep1(footid9).id
`gosub Setupland1
`gosub make_player
`set global collision off
`sync rate 60
set camera range 10,40000
`gosub Resetcam
enable escapekey
set ambient light 100
do
if keystate(44)
hide object Object(playerid).id
ENDIF
TiltObjectToTerrain(terrain,Object(playerid).id)
remstart
`Control Camera
position camera 0,0,0
if mouseclick()=0
xrotate camera camera angle x()-mousemovey()*0.25
yrotate camera camera angle y()+mousemovex()*0.25
if camera angle x()>80 then xrotate camera 80
if camera angle x()<-60 then xrotate camera -60
endif
if mouseclick()>0 then CamDis#=CamDis#-mousemovey()*0.25
CamDis#=CamDis#+mousemovez()*0.25
if upkey()=1 then CamDis#=CamDis#+2.5
if downkey()=1 then CamDis#=CamDis#-2.5
if CamDis#>-20 then CamDis#=-20
if CamDis#<-300 then CamDis#=-300
move camera CamDis#
if camera position y()<-60 then position camera camera position x(),-60,camera position z()
mousemovex()=0
mousemovey()=0
`Rotate object
if KEYSTATE(19)=1 and rotate=1 and nopress=0 then rotate=0:nopress=1
if KEYSTATE(19)=1 and rotate=0 and nopress=0 then rotate=1:nopress=1
if rotate=0
rotate object 1,0,object angle y(1)+0.5,0
endif
`Change Texture
if KEYSTATE(20)=1 and nopress=0
delete image 2
inc image
if image>3 then image=1
if image=1 then load image "Media/Cube0.dds",2,2
if image=2 then load image "Media/Cube1.dds",2,2
if image=3 then load image "Media/Cube2.dds",2,2
texture object 1,1,2
texture object 2,1,2
texture object 3,0,2
nopress=1
endif
`Change Object
if Spacekey()=1 and nopress=0
delete object 1
inc object
if object>5 then object=1
if object=1 then load object "Media/t-pot.x",1:scale object 1,4000,4000,4000:scale object texture 1,4,2:object=1
if object=2 then load object "Media/Tosus.x",1:scale object texture 1,0,1.5,1
if object=3 then make object box 1,75,75,75
if object=4 then make object sphere 1,75,40,40:scale object texture 1,0,2,1
if object=5 then make object cylinder 1,75:scale object texture 1,0,3,1
texture object 1,0,1:texture object 1,1,2
set object effect 1,1
set object mask 1,2^FrameCamera
nopress=1
endif
if scancode()=0 then nopress=0
`Text
center text sw/2-text width("R - Rotate Object T - Change Texture Space - Change Object")/2,20,"R - Rotate Object T - Change Texture Space - Change Object"
center text sw/2-text width("FPS "+str$(screen fps()))/2,50,"FPS "+str$(screen fps())
remend
ox#=object position x(Object(playerid).id)
oy#=object position y(Object(playerid).id)
oz#=object position z(Object(playerid).id)
position mouse screen width()/2, screen height()/2
Text 10,10,"FPS "+str$(screen fps())
Text 10,30,"TBM Timer Speed:"+str$(screen fps()*TBM_Move(.05))
Move()
x#=object position x(Object(playerid).id)
y#=object position y(Object(playerid).id)
z#=object position z(Object(playerid).id)
UpdateLandGen()
Set Active Window GET DBPRO WINDOW()
GRAB FOCUS
UpdateGame()
remstart
if z#<>oz#
i = LookUpEnv("grassland")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("desert")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid2).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("rock")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid3).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("battlefield")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid4).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("reeds")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid5).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("scrub")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid6).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("swamp")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid7).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("forest")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid8).id
FootstepTime = timer()
endif
ENDIF
i = LookUpEnv("border")
if i > 0
if FootstepTime < timer() - 500
play sound footstep1(footid9).id
FootstepTime = timer()
endif
ENDIF
endif
remend
text 10,70,"real fps:"+str$(screen fps()*TBM_Move(.05)+screen fps())
TBM_Update
fastsync
loop
delete object Object(playerid).id
for x=0 to 9
delete sound x
NEXT
delete music music
function TiltObjectToTerrain(terrain as integer,object as integer)
objsizex#=object size x(object,1)
objsizez#=object size z(object,1)
offset=int(objsizez#/2):rearoffset=frontoffset:sideoffset=int(objsizex#/2)
x#=object position x(object)
z#=object position z(object)
local stepv as float
stepv=OBJECT SIZE Z(object,1)*0.50 `Play around with this if you want. It tells how far from the object's origin the functions goes when getting the side and front heights.
ang#=object angle y(object)
h1# = 10000-intersect object(terrain,x#,10000,z#,x#,-10000,z#) + Offset#
tx# = newxvalue(x#,wrapvalue(ang#+90),stepv)
tz# = newzvalue(z#,wrapvalue(ang#+90),stepv)
h2# = 10000-intersect object(terrain,tx#,10000,tz#,x#,-10000,z#) + Offset#
at# = h2# - h1#
b# = stepv
angz# = atan(at#/b#)*1
tx# = newxvalue(x#,ang#,stepv)
tz# = newzvalue(z#,ang#,stepv)
h2# = 10000-intersect object(terrain,tx#,10000,tz#,x#,-10000,z#) + Offset#
at# = h2# - h1#
angx# = 360 - atan(at#/b#)*1
rotate object object,angx#,object angle y(object),angz#
endfunction h1#
function load_objects()
`PLAYER
load object "mourner.dbo",Object(playerid).id
fix object pivot Object(playerid).id
position object Object(playerid).id,100,1,100
endfunction
function bar(x, y, width, height, load$, P#)
P# = P#/100
if P#<0.0 then P#=0.0
rem gradient bar
seg = width / 3
box x, y, x+seg, y+height, rgb(0,0,0),rgb(0,0,0),rgb(85,0,0),rgb(85,0,0)
box x+seg, y, x+seg+seg, y+height, rgb(85,0,0),rgb(85,0,0),rgb(170,0,0),rgb(170,0,0)
box x+seg+seg, y, x+width, y+height, rgb(170,0,0),rgb(170,0,0),rgb(255,0,0),rgb(255,0,0)
rem empty bit
ink rgb(92,92,92),0
box x+width*P#, y, x+width, y+height
rem highlight
c1 = 0xCCFFFFFF
c2 = 0x33FFFFFF
box x, y, x+width, y+height*0.5, c2,c1,c2,c1
ink rgb(255,255,255)
center text x,y,load$
endfunction
Function LoadGame()
remstart
load sound "Medieval castles and ruins with medieval music 2.ogg",1
loop sound 1
remend
fog on
hide mouse
backdrop on
Color Backdrop RGB(120, 120, 120)
Autocam Off
set camera range .1, 5000
global u#
global v#
Progress111("Loaded data ("+str$(int(1.0/20.0*(100.0)))+"%)",1.0/20.0)
load_objects()
Progress111("Loaded data ("+str$(int(2.0/20.0*(100.0)))+"%)",2.0/20.0)
Progress111("Loaded data ("+str$(int(3.0/20.0*(100.0)))+"%)",3.0/20.0)
Progress111("Loaded data ("+str$(int(4.0/20.0*(100.0)))+"%)",4.0/20.0)
Progress111("Loaded data ("+str$(int(5.0/20.0*(100.0)))+"%)",5.0/20.0)
Progress111("Loaded data ("+str$(int(6.0/20.0*(100.0)))+"%)",6.0/20.0)
Progress111("Loaded data ("+str$(int(7.0/20.0*(100.0)))+"%)",7.0/20.0)
Progress111("Loaded data ("+str$(int(8.0/20.0*(100.0)))+"%)",8.0/20.0)
Progress111("Loaded data ("+str$(int(9.0/20.0*(100.0)))+"%)",9.0/20.0)
Progress111("Loaded data ("+str$(int(10.0/20.0*(100.0)))+"%)",10.0/20.0)
Progress111("Loaded data ("+str$(int(11.0/20.0*(100.0)))+"%)",11.0/20.0)
Progress111("Loaded data ("+str$(int(12.0/20.0*(100.0)))+"%)",12.0/20.0)
Progress111("Loaded data ("+str$(int(13.0/20.0*(100.0)))+"%)",13.0/20.0)
Progress111("Loaded data ("+str$(int(14.0/20.0*(100.0)))+"%)",14.0/20.0)
Progress111("Loaded data ("+str$(int(15.0/20.0*(100.0)))+"%)",15.0/20.0)
Progress111("Loaded data ("+str$(int(16.0/20.0*(100.0)))+"%)",16.0/20.0)
Progress111("Loaded data ("+str$(int(17.0/20.0*(100.0)))+"%)",17.0/20.0)
Progress111("Loaded data ("+str$(int(18.0/20.0*(100.0)))+"%)",18.0/20.0)
Progress111("Loaded data ("+str$(int(19.0/20.0*(100.0)))+"%)",19.0/20.0)
Progress111("Loaded data ("+str$(int(20.0/20.0*(100.0)))+"%)",20.0/20.0)
it=1
if it
set text font "MS Gothic"
set text size 10
set text to bold
it=0
endif
loaded = 1
EndFunction
function UpdateGame()
xrotate object Object(playerid).id,wrapvalue(object angle x(Object(playerid).id)+mousemovey()/2.0*TBM_Move(.01))
yrotate object Object(playerid).id,wrapvalue(object angle y(Object(playerid).id)+mousemovex()/2.0*TBM_Move(.01))
remstart
if keystate(17) or upkey() or mouseclick()=1 then move object Object(playerid).id,7*TBM_Move(.01)
if keystate(31) or downkey() or mouseclick()=2 then move object Object(playerid).id,-7*TBM_Move(.01)
if keystate(30) or leftkey() then dec ang#,7*TBM_Move(.01)
if keystate(32) or rightkey() then inc ang#,7*TBM_Move(.01)
if ang#>360 then ang#=0
if ang#<-360 then ang#=0
`position object Sky(skyid).id,object position x(Object(playerid).id),object position y(Object(playerid).id),object position z(Object(playerid).id)
remend
`Player 1's co-ordinates
X1# = object position x(Object(playerid).id)
Y1# = object position y(Object(playerid).id)
Z1# = object position z(Object(playerid).id)
Angle1# = object angle y(Object(playerid).id)
`Player 1's movement
`If upkey() = 1 or keystate(17) then Move object Object(playerid).id, .1
`If downkey() = 1 or keystate(31) then Move object Object(playerid).id, -.1
`If leftkey() = 1 or keystate(30) then Dec Angle1#, 1
`If rightkey() = 1 or keystate(32) then Inc Angle1#, 1
Rotate object Object(playerid).id, 0, ang#+Angle1#, 0
`rotate object Landscape(terrainpiv).piv,0,object angle y(Object(playerid).id),0
`Set camera to follow X1#, Y1#, Z1#, Angle1#, 40, 4, 9, 1
`if object visible(Object(playerid).id)
if keystate(44) and (Object(playerid).health# > 0.0)
dec Object(playerid).health#,100
if Object(playerid).health#>Object(playerid).maxhealth#
Object(playerid).health#=Object(playerid).maxhealth#
endif
endif
if keystate(45) and (Object(playerid).health# < Object(playerid).maxhealth#)
inc Object(playerid).health#,100
if Object(playerid).health#<0
Object(playerid).health#=0
endif
endif
`endif
text 10,50,"y:"+str$(object angle y(Object(playerid).id))
ENDFUNCTION
FUNCTION Progress111(t$,prog#)
if prog#>100.0 then prog#=100.0
prog_x=(screen width()/2)-128
prog_y=(screen height()/2)
ink rgb(255,255,255),0
center text prog_x+128,prog_y-16,t$
ink rgb(16,16,16),0
box prog_x-1,prog_y-1,prog_x+257,prog_y+17
`ink rgb(255,16,16),0
box prog_x-1,prog_y-1,prog_x+1+(prog#*256),prog_y+17,rgb(255,0,0),rgb(0,255,0),rgb(0,0,255),rgb(255,0,255)
sync
ENDFUNCTION
function round(n#,r)
n#= n#/r
n= int(n#+n#)-int(n#)
n= n*r
endfunction n
function rgbalpha(r,g,b,a)
c = (a and 0xff) << 24 or ((r and 0xff) << 16) or ((g and 0xff) << 8) or (b and 0xff)
endfunction c
function CreateBar(theobj,twodorthreed,posx=0,posy=0,id,x,y,width,height,P#,c1,c2,max#)
if bitmap exist(id)=0
CREATE BITMAP id,width,height
endif
set current bitmap id
P# = P#/max#
if P#<0.0 then P#=0.0
rem gradient bar
seg = width / 3
box x, y, x+seg, y+height, c2,c1,c2,c1
box x+seg, y, x+seg+seg, y+height, c2,c1,c2,c1
box x+seg+seg, y, x+width, y+height, c2,c1,c2,c1
` box x, y, x+seg, y+height, rgbalpha(255,0,0,255),rgbalpha(255,0,0,255),rgbalpha(170,85,0,255),rgbalpha(170,85,0,255)
` box x+seg, y, x+seg+seg, y+height, rgbalpha(170,85,0,255),rgbalpha(170,85,0,255),rgbalpha(85,170,0,255),rgbalpha(85,170,0,255)
` box x+seg+seg, y, x+width, y+height, rgbalpha(85,170,0,255),rgbalpha(85,170,0,255),rgbalpha(0,255,0,255),rgbalpha(0,255,0,255)
` rem empty bit
` ink rgb(92,92,92),0
` box x+width*P#, y, x+width, y+height
rem highlight
box x, y, x+width, y+height*0.5, c2,c1,c2,c1
ink rgb(255,255,255),0
center text width/2,0,getnumber(int(P#*max#))+"/"+getnumber(int(max#))
if twodorthreed=0
GET IMAGE id,0,0,width,height,1
set current bitmap 0
paste image id,posx,posy
else
GET IMAGE id,0,0,width,height,1
set current bitmap 0
if object exist(obj11)
texture object obj11,id
else
exitfunction
endif
endif
endfunction
function getnumber(num)
n$=str$(num)
if num>999
n=num/1000
if n>999
m=n/1000
leng=len(str$(m))
re$=mid$(n$,leng+1)+mid$(n$,leng+2)
re$=mid$(n$,2)+mid$(n$,3)
r#=val(re$)
if r#>0.0
re$="."+re$
else
re$=""
endif
s$=str$(m)+re$+"M"
else
leng=len(str$(n))
re$=mid$(n$,leng+1)+mid$(n$,leng+2)
r#=val(re$)
if r#>0.0
re$="."+re$
else
re$=""
endif
s$=str$(n)+re$+"K"
endif
else
s$=str$(num)
endif
endfunction s$
function glue_object_to_object(a,b)
`get start and end point offsets
`start point
EZro_ObjFindOffsetFromPoint b, object position x(a),object position y(a),object position z(a)
x1#=EZro_GetOffsetX()
y1#=EZro_GetOffsetY()
z1#=EZro_GetOffsetZ()
`end point
move object a, 1
EZro_ObjFindOffsetFromPoint b, object position x(a),object position y(a),object position z(a)
x2#=EZro_GetOffsetX()
y2#=EZro_GetOffsetY()
z2#=EZro_GetOffsetZ()
`position child
position object a, x1#,y1#,z1#
`point at end point
point object a, x2#,y2#,z2#
`glue to main limb
glue object to limb a, b, 0
endfunction
function GetDist(camon,cam,myobj1,myobj2)
select camon
case 0
if myobj1<>0 and myobj2<>0
x1#=Object Position X(myobj2)
y1#=Object Position Y(myobj2)
z1#=Object Position Z(myobj2)
x2#=Object Position X(myobj1)
y2#=Object Position Y(myobj1)
z2#=Object Position Z(myobj1)
endif
endcase
case 1
if myobj1<>0
x1#=Camera Position X(cam)
y1#=Camera Position Y(cam)
z1#=Camera Position Z(cam)
x2#=Object Position X(myobj1)
y2#=Object Position Y(myobj1)
z2#=Object Position Z(myobj1)
endif
endcase
endselect
dist# = FML Distance(x1#,y1#,z1#,x2#,y2#,z2#)
endfunction dist#
function get_dx(ver)
version = windows version()
dir$=DIR SYSTEM()+"\"
select ver
case 9
if file exist(dir$+"d3dx9_24.dll")=0 or file exist(dir$+"d3dx9_25.dll")=0 or file exist(dir$+"d3dx9_26.dll")=0 or file exist(dir$+"d3dx9_27.dll")=0 or file exist(dir$+"d3dx9_28.dll")=0 or file exist(dir$+"d3dx9_29.dll")=0 or file exist(dir$+"d3dx9_30.dll")=0 or file exist(dir$+"d3dx9_31.dll")=0 or file exist(dir$+"d3dx9_32.dll")=0 or file exist(dir$+"d3dx9_33.dll")=0 or file exist(dir$+"d3dx9_34.dll")=0 or file exist(dir$+"d3dx9_35.dll")=0 or file exist(dir$+"d3dx9_36.dll")=0 or file exist(dir$+"d3dx9_37.dll")=0 or file exist(dir$+"d3dx9_38.dll")=0 or file exist(dir$+"d3dx9_39.dll")=0 or file exist(dir$+"d3dx9_40.dll")=0 or file exist(dir$+"d3dx9_41.dll")=0 or file exist(dir$+"d3dx9_42.dll")=0 or file exist(dir$+"d3dx9_43.dll")=0
center text screen width()/2, screen height()/2, "PLEASE download directx 9.0c (June 2009) to play this game"
center text screen width()/2, screen height()/2+20, str$(version)
center text screen width()/2, screen height()/2+40, dir$
sync
wait key
end
ENDIF
endcase
case 10
`if file exist(dir$+"d3dx10.dll")=0 or file exist(dir$+"d3dx10_33.dll")=0 or file exist
`center text screen width()/2, screen height()/2, "PLEASE download directx 10!"
`center text screen width()/2, screen height()/2+20, str$(version)
`center text screen width()/2, screen height()/2+40, dir$
`sync
`wait key
`ENDIF
endcase
endselect
ENDFUNCTION
world.dba:
function InitWorld
imgTer = Find Free Image()
Load Image "terrain\HM0000.bmp", imgTer
imgEnv = Find Free Image()
Load Image "terrain\EnvMap0000.png", imgEnv
BT SetATMode 1
terrain = BT MakeTerrain()
BT SetTerrainHeightMap terrain, imgTer
BT SetTerrainEnvironment terrain, imgEnv
BT SetTerrainScale terrain, 5
BT SetTerrainYScale terrain, .2
BT SetTerrainSplit terrain, 128
BT SetTerrainLOD terrain, 3
BT SetTerrainLODDistance terrain, 1, 1500.0
BT SetTerrainLODDistance terrain, 2, 1000.0
BT SetTerrainSmoothing terrain, 7
BT SetTerrainQuadRotation terrain, 1
For i = 1 to Array Count(environments())
e = BT AddTerrainEnvironment(terrain, RGB(environments(i).ColorR, environments(i).ColorG, environments(i).ColorB))
Next
i = LookUpEnv( "road")
environments(i).veg = 0
i = LookUpEnv( "border")
environments(i).veg = 0
BT BuildTerrain terrain, 1
BT SetBuildStep 0
repeat
progress = BT ContinueBuild()
until progress=-1
set Object effect terrain, terFX
Global objScale
objScale = BT GetTerrainSize(terrain) / Image Width(imgTer)
Global WorldSize
WorldSize = BT GetTerrainSize(terrain)
Global map
map = FindFreeObject()
Make Object Plain map, 100, 100
mapImg = Find Free Image()
Load Image "terrain/map.png", mapImg
Texture Object map, mapImg
Position Object map, 0, 0, 100
Lock Object On map
Global mapMarker
mapMarker = FindFreeObject()
Make Object Sphere mapMarker, 1
mapImg = Find Free Image()
Position Object mapMarker, -50, -50, 99
Lock Object On mapMarker
Hide Object map
Hide Object mapMarker
endFunction
Function UpdateWorld
BT SetCurrentCamera 0
BT UpdateTerrainLOD terrain
BT UpdateTerrainCull terrain
BT RenderTerrain terrain
EndFunction
thanks!
CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/