Hi there!
I was bored so I wrote a tricky little endless zoomer. It creates a recursive object in which the camera endlessly zooms in.
Screenshot:
http://xbasix.xb.ohost.de/codes.php?code=endlesszoom&img=yes
20 liner:
set display mode 1024, 768, 32 : Sync On : Sync Rate 0 : Sync : autocam off : set text font "Arial"
color backdrop rgb( 150, 100, 30 ) : fog on : fog color 150, 100, 30 : global limbnr as integer = 1 : cls : print "please wait" : sync
make object cube 1, 100 : CreateStruct( 5, 0, 0, 0, 100, %000000 ) : make mesh from object 1, 1 : delete object 1 : make object 1, 1, 0 : delete mesh 1 : position camera -200, 0, -500
Do : set cursor 0, 0 : print "FPS: ", screen fps( ), " | Polys: ", statistic( 1 ) : line 10, screen height() - 15, screen width()*.5 - 80, screen height() - 15
line screen width()*.5 + 80, screen height() - 15, screen width() - 10, screen height() - 15 : center text screen width()*.5, screen height() - 20, "Endless Zoom Demo - by Azrael 2007"
move camera -camera position z()*0.001 : If camera position z() > -50 : position camera -200, 0, -150 : endif : fog distance -camera position z()*2 : sync : Loop
Function CreateStruct( Level as integer, x as float, y as float, z as float, size as float, code as dword)
o as integer : o = FreeObject( ) : make object cube o, size : make mesh from object o, o : add limb 1, limbnr, o : delete mesh o : delete object o
offset limb 1, limbnr, x, y, z : inc limbnr : size = size*0.3333 : if level > 0 : dec Level
If ( code && %100000 ) = 0 then CreateStruct( Level, x + size*4, y, z, size, %010000 )
If ( code && %010000 ) = 0 then CreateStruct( Level, x - size*4, y, z, size, %100000 )
If ( code && %001000 ) = 0 then CreateStruct( Level, x, y + size*4, z, size, %000100 )
If ( code && %000100 ) = 0 then CreateStruct( Level, x, y - size*4, z, size, %001000 )
If ( code && %000010 ) = 0 then CreateStruct( Level, x, y, z + size*4, size, %000001 )
If ( code && %000001 ) = 0 then CreateStruct( Level, x, y, z - size*4, size, %000010 )
endif
endfunction
Function FreeObject( )
o as integer = 0 : Repeat : o = rnd( 1000 ) + 1 : Until object exist( o ) = 0
endfunction o
Uncompressed Code:
set display mode 1024, 768, 32
Sync On : Sync Rate 0 : Sync
autocam off : set text font "Arial"
color backdrop rgb( 150, 100, 30 )
fog on : fog color 150, 100, 30
global limbnr as integer = 1
cls
print "please wait"
sync
make object cube 1, 100
CreateStruct( 5, 0, 0, 0, 100, %000000 )
make mesh from object 1, 1
delete object 1
make object 1, 1, 0
delete mesh 1
position camera -200, 0, -500
Do
set cursor 0, 0
print "FPS: ", screen fps( ), " | Polys: ", statistic( 1 )
line 10, screen height() - 15, screen width()*.5 - 80, screen height() - 15
line screen width()*.5 + 80, screen height() - 15, screen width() - 10, screen height() - 15
center text screen width()*.5, screen height() - 20, "Endless Zoom Demo - by Azrael 2007"
move camera -camera position z()*0.001
If camera position z() > -50
position camera -200, 0, -150
endif
fog distance -camera position z()*2
sync
Loop
Function CreateStruct( Level as integer, x as float, y as float, z as float, size as float, code as dword)
o as integer
o = FreeObject( )
make object cube o, size
make mesh from object o, o
add limb 1, limbnr, o
delete mesh o
delete object o
offset limb 1, limbnr, x, y, z
inc limbnr
size = size*0.3333
if level > 0
dec Level
If ( code && %100000 ) = 0 then CreateStruct( Level, x + size*4, y, z, size, %010000 )
If ( code && %010000 ) = 0 then CreateStruct( Level, x - size*4, y, z, size, %100000 )
If ( code && %001000 ) = 0 then CreateStruct( Level, x, y + size*4, z, size, %000100 )
If ( code && %000100 ) = 0 then CreateStruct( Level, x, y - size*4, z, size, %001000 )
If ( code && %000010 ) = 0 then CreateStruct( Level, x, y, z + size*4, size, %000001 )
If ( code && %000001 ) = 0 then CreateStruct( Level, x, y, z - size*4, size, %000010 )
endif
endfunction
Function FreeObject( )
o as integer = 0
Repeat
o = rnd( 1000 ) + 1
Until object exist( o ) = 0
endfunction o
Have fun