Hi there
For all those who like the games of secret dungeons and corridors, here I come with an example of a fany dungeon creator. The script works in Time Lapse mode, so we can see the whole process .
Here we go !
`texture for walls...we had better load our texture.
hide mouse
create bitmap 1,100,100
ink rgb(100,100,100),1
box 0,0,100,100
for i= 1 to 1000
col=50+rnd(50)
ink rgb(col,col,col),1
dot rnd(100),rnd(100)
line rnd(100),rnd(100),rnd(100),rnd(100)
next
blur bitmap 1,2
ink rgb(60,60,60),0
box 0,0,100,3
ink rgb(20,20,20),0
box 0,0,100,1
ink rgb(60,60,60),0
box 0,25,100,28
ink rgb(20,20,20),0
box 0,25,100,26
ink rgb(60,60,60),0
box 0,50,100,53
ink rgb(20,20,20),0
box 0,50,100,51
ink rgb(60,60,60),0
box 0,75,100,78
ink rgb(20,20,20),0
box 0,75,100,76
get image 2,0,0,100,100,1
delete bitmap 1
autocam off
color backdrop 0
position camera -50,50,-50
point camera 0,0,0
`blocks to make the level
make object box 1000,15,25,15
`TIMELAPSE TO SEE HOW IT IS BUILT
a()
make object box 2000,15,25,15:color object 2000,rgb(0,255,0):position object 2000,-20,0,5
a()
position object 2000,-13,0,13
perform csg difference 1000,2000
a()
position object 2000,13,0,13
perform csg difference 1000,2000
a()
position object 2000,13,0,-13
perform csg difference 1000,2000
a()
position object 2000,-13,0,-13
perform csg difference 1000,2000
a()
clone object 3000,2000: move object up 3000,17:perform csg difference 2000,3000:delete object 3000
a()
make mesh from object 1,1000
make mesh from object 2,2000
delete object 1000:position object 2000,0,0,0:scale object 2000,10,100,10
make object sphere 7000,1000:scale object 7000,1,0.3,1:make mesh from object 15,7000:delete object 7000
luz=7000
lii=1
position camera -200,200,200
repeat
move object 2000,15 :a()
if object collision(2000,0)=0 then inc ob: make object ob,2,1:position object ob,object position x(2000),0,object position z(2000)
if rnd(1)=0 then yrotate object 2000,90*rnd(3)
if rnd(5)=1 and object exist(ob) then change mesh ob,0,1 :inc lii :make light lii:position light lii,object position x(ob),2,object position z(ob):set light range lii,40
point camera object position x(1),0,object position z(1)
if object size y(ob)>20 then inc luz:make object luz,15,0:position object luz,object position x(ob),13.3,object position z(ob):set object collision off luz
if light exist(2) then color light 2,rgb(255,0,0)
if light exist(3) then color light 3,rgb(255,255,0)
if light exist(4) then color light 4,rgb(0,255,0)
if light exist(5) then color light 5,rgb(155,0,0)
if light exist(6) then color light 6,rgb(155,155,0)
if light exist(7) then color light 7,rgb(0,0,255)
if light exist(8) then color light 8,rgb(255,255,255)
until ob=30 `30 BLOCKS ARE OK FOR NOW...
make object plain 3000,40,40
a()
color object 3000,rgb(0,255,0)
a()
position object 3000,object position x(1),0,object position z(1)
a()
for i= 1 to ob
perform csg difference 3000,i
delete object i
next
scale object texture 3000,1,2
set object radius 3000,0
a()
texture object 3000,2
a()
set ambient light 2
hide light 0
make light 1:set light range 1,20
position camera object position x(2000),0,object position z(2000)
delete object 2000
sync on
do
gosub camera_controls
set cursor 0,0
ink rgb(255,255,0)
print "SPACEKEY saves level"
if spacekey() then save object "Level.dbo",3000 :sleep 1000
sync
loop
function a()
sleep 100
endfunction
camera_controls:
control camera using arrowkeys 0,0.1,0.1
a#=wrapvalue(a#+mousemovex()/2)
cam#=wrapvalue(cam#+mousemovey()/2)
rotate camera cam#,a#,0
if leftkey() then move camera left 0.1
if rightkey() then move camera right 0.1
position light 1,camera position x(),camera position y(),camera position z()
x#=camera position x()
z#=camera position z()
position camera x#,-5,z#
return
I'm not a grumpy grandpa
