set display mode 1024,768,32
sync on : sync rate 0
`make camera
make camera 1
`set range for camera
range#=30
`camera is set for that range
set camera range 1,1,range#
SET CAMERA FOV 1, 100
`giving x = well be are object number
x = 1
`load a image
load image "cool.jpg",1
`color the background
color backdrop 1,0
`create a for loop so we can have 400 buildings
for x = 1 to 500
`load the object
load object "b1.dbo",x
`texture the object
texture object x,1
`rotatae the object
rotate object x,-90,0,0
`add random position's of the object
position object x,30+rnd(30),0,20+rnd(300)
`add random scale's of the object as in height and width
scale object x,100+rnd(100),100+rnd(100),100+rnd(100)
set object cull x,1
`position the camera at a certain level
position camera 1,-10,7.8,320
rotate camera 1,0,0,-90
`end of the for loop
next x
do
`checking to see if object exist's trying to get the correct number of objects it should be 100 `cause am using a delete object and a range of 100
if object exist(x) > 0 and object exist(x) <= 201
text 20,50,"how many buildings in scene : "+str$(x)
endif
`this checks there is 500 buildings
if x > 0 and x <=500
`and range greater then 0 and equal to 30
if range# > 0 and range# <= 30
`this only suppsoe to show 100 objects in the range# 30 meaning the rest is deleted
show object x+1*100
else
`this says if its above 30 and i made some number like 1000
if range# > 30 and range# <= 1000
`then delete the rest of the objects that the range doesn't see
if object exist(x)<= 400
delete object x
endif
endif
endif
endif
if spacekey()=1
save object "b1.dbo",1
endif
rotate camera 1,mousey()*1.1,mousex()*1.1,0
if upkey()=1 then move camera 1,0.1
if downkey()=1 then move camera 1,-0.1
text 20,130,"Camera range#: "+str$(range#)
text 20,90,"FPS "+str$(screen fps())
text 20,20,"VeRsUaL's RandomCityGenerator rebuilt v1.0 64 bit"
text 20,70,"polys in in scene : "+str$(STATISTIC(1))
sync
loop