`set display mode 1280, 1024, 32
set camera fov 150
set camera range 0.5, 50
set text font "Courier New"
set text size 32
randomize timer()
sync on
sync rate 60
hide mouse
 
 
#constant O_MASS 0.1
 
make memblock 1, 16
write memblock dword 1, 0, 1
write memblock dword 1, 4, 1
write memblock dword 1, 8, 32
write memblock dword 1, 12, 0x2F000000
make image from memblock 1, 1
delete memblock 1
sprite 1, 0, 0, 1
size sprite 1, screen width(), screen height()
set sprite 1, 1, 1
hide sprite 1
 
 
text 0,0, "+": text 0,0, "O"
get image 2, 0, 0, 31, 31, 1
cls
 
 
 
 
 
 
 
 
 
set text to bold
print "0"
print "1"
print "2"
print "3"
print "4"
print "5"
print "6"
print "7"
print "8"
print "9"
for i = 0 to 9
   get image i+10, 0, i*31, 31, (i+1)*31, 1
next i
cls
 
 
Type Coord3D
   x as float
   y as float
   z as float
EndType
Type Num
   p as Coord3D
   s as Coord3D
   fired as boolean
   val as byte
EndType
#constant FIRE_QUEUE_SIZE 20
 
dim n(FIRE_QUEUE_SIZE) as Num
Dim FiringQueue()
 
for i = 1 to FIRE_QUEUE_SIZE
   make object plain i, 4, 4
   scroll object texture i, -0.25, 0.0
   set object texture i, 0, 1
   setupNum(i)
next i
 
 
 
 
 
 
 
make object triangle 100, 0.5,0,0,   0,0,-10,   -0.5,0,0
position object 100, 0, 15, 40
color object 100, 0xCC0000FF : set object transparency 100, 3
hide object 100
 
 
 
position camera 0, 20, 40
point camera 0, 15, 0
 
 
lastFired = timer()
#constant FIRE_DELAY 250
 
temp = timer()
 
backdrop off
 
frameTime# = 1.0
startTime = timer()
do
   frameTime# = (frameTime# * 0.8) + ((timer() - startTime) * 0.2)
   startTime = timer()
 
   if timer() - lastFired > FIRE_DELAY AND array count(FiringQueue()) > 0
      array index to queue FiringQueue()
      n(FiringQueue()).fired = 1
      exclude object off FiringQueue()
      remove from queue FiringQueue()
      lastFired = timer()
   endif
 
 
   for i = 1 to FIRE_QUEUE_SIZE
      if n(i).fired
         inc n(i).s.y, frameTime# * -0.098 * O_MASS
         inc n(i).p.x, n(i).s.x * frameTime# * 0.001
         inc n(i).p.y, n(i).s.y * frameTime# * 0.001
         inc n(i).p.z, n(i).s.z * frameTime# * 0.001
 
         if n(i).p.z > camera position z()
            setupNum(i)
         else
            position object i, n(i).p.x, n(i).p.y, n(i).p.z
            if n(i).p.z < 15
               a# = 100.0 * n(i).p.z / 15.0
               if a# > 100.0 then a# = 100.0
               set alpha mapping on i, a#
            else
               set alpha mapping on i, 100.0
            endif
         endif
      endif
   next i
 
 
   paste image 2, mousex()-7, mousey()-15, 1
   obj = pick object(mousex(), mousey(), 1, FIRE_QUEUE_SIZE)
 
   if object visible(100)
      hide object 100
   else
      if obj > 0
         if mouseclick() = 1
            if timer() - temp > FIRE_DELAY
               temp = timer()
               show object 100
               lock vertexdata for limb 100, 0, 1
               set vertexdata position 1, get pick vector x(), get pick vector y()+5, get pick vector z()
               unlock vertexdata
 
               setupNum(obj)
            endif
         endif
      endif
   endif
 
   paste sprite 1, 0, 0
   sync
loop
end
 
 
function setupNum(i)
   n(i).val = rnd(9) + 10
   texture object i, n(i).val
 
   n(i).p.x = 0.0
   n(i).p.y = 0.0
   n(i).p.z = 0.0
 
   n(i).s.x = (rndFloat() * 8.0) - 4.0
   n(i).s.y = 20.0 * (1.0 + (rndFloat() * 0.25))
   n(i).s.z = 10.0 * (1.0 + (rndFloat() * 0.25))
 
   position object i, n(i).p.x, n(i).p.y, n(i).p.z
   point object i, n(i).p.x, n(i).p.y, n(i).p.z + 1
 
   add to queue FiringQueue() : FiringQueue() = i
   n(i).fired = 0
   exclude object on i
 
   if rnd(1)
      set object emissive i, 0xFF0000
   else
      set object emissive i, 0x00FF00
   endif
endfunction
 
 
 
 
 
function rndFloat()
  f as float
  f = rnd(1048575.0) / 1048575.0
endfunction f