sync on
sync rate 0
set ambient light 100
 
randomize timer()
#constant CUBE_COUNT 50
#constant IMG_SIZE 256
backdrop on
color backdrop 0
 
 
c as dword
make memblock 1, 12 + (IMG_SIZE * IMG_SIZE * 4)
write memblock dword 1, 0, IMG_SIZE
write memblock dword 1, 4, IMG_SIZE
write memblock dword 1, 8, 32
for x = 0 to IMG_SIZE-1
   for y = 0 to IMG_SIZE-1
      c = rgb(0,0,((sin(( y )*5.6470588235294117647058823529412)+1)*127))
      write memblock dword 1, 12 + (4 * (x + (y*IMG_SIZE))), c && 0x99FFFFFF
   next y
next x
make image from memblock 1, 1
 
remstart
for x = 0 to IMG_SIZE-1
   for y = 0 to IMG_SIZE-1
      c = rgb(0,((sin(( (x+1)*(y+1) )*5.6470588235294117647058823529412)+1)*127), 0)
      write memblock dword 1, 12 + (4 * (x + (y*IMG_SIZE))), c && 0x33FFFFFF
   next y
next x
make image from memblock 2, 1
remend
delete memblock 1
 
 
Type FlyingThing
   Speed as float
   Pos as float
EndType
 
 
for i = 1 to 1
   make object cube        i, -20 + (i*2)
   scale object            i, 100, 100, 1000
   texture object          i, i
   set object transparency i, 3
   scale object texture    i, 100, 100
next i
 
 
 
dim Thingies(CUBE_COUNT) as FlyingThing
for i = 1 to CUBE_COUNT
   make object cube 10+i, 8
   Thingies(i).Speed = rnd(30) + 20
   Thingies(i).Pos = rnd(100)
 
   select rnd(3)
      case 0
         `This is the top
         position object 10+i, rnd(20)-10, 10, Thingies(i).Pos
      endcase
 
      case 1
         `This is the right
         position object 10+i, 10, rnd(20)-10, Thingies(i).Pos
      endcase
 
      case 2
         `This is the bottom
         position object 10+i, rnd(20)-10, -10, Thingies(i).Pos
      endcase
 
      case 3
         `This is the left
         position object 10+i, -10, rnd(20)-10, Thingies(i).Pos
      endcase
   endselect
next i
 
autocam off
set camera range 0.1, 200
set camera fov 175
position camera 0, 0, -49
point camera 0,0,0
frameTime# = 1.0
startTime = timer()
do
   frameTime# = (frameTime# * 0.8) + ((timer() - startTime) * 0.2)
   startTime = timer()
   text 0,0, "FPS: " + str$(screen fps())
 
`   paste image 2, 0, 0,1
 
 
   for i = 1 to CUBE_COUNT
      dec Thingies(i).Pos, frameTime# * Thingies(i).Speed * 0.001
      if Thingies(i).Pos < -50 then Thingies(i).Pos = 100
      obj = 10+i
      position object obj, object position x(obj), object position y(obj), Thingies(i).Pos
   next i
 
   scroll object texture 1, 0, frameTime# * 0.001
   sync
loop