Author Topic: Matrix Effect  (Read 3588 times)

0 Members and 1 Guest are viewing this topic.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Matrix Effect
« on: March 08, 2007 »

Code: [Select]
open window 640, 512
resx = 80
resy = 64
size = 640/resx
dim buffer(resx,resy)
dim drop(resx), fall(resx)

for a = 0 to resx
  drop(a) = rnd(resy)
  fall(a) = rnd(0.5)+0.5
next

repeat
  setdispbuf draw
  draw = 1 - draw
  setdrawbuf draw
  a = 0
  for x = 0 to resx a = a + size
    drop(x) = drop(x) + fall(x)
    if (drop(x) > resy) then
      drop(x) = drop(x) - resy
      fall(x) = rnd(0.5) + 0.5
    fi
    buffer(x,drop(x)) = 255
    b = 0
    for y = 0 to resy b = b + size
      c = buffer(x,y)
      setrgb 1, 0, c, 0
      fill box a,b to a-size,b-size
      buffer(x,y) = c - 4
    next
  next
until (0=1)

sub rnd(range) rnd$ = time$ : length = len(rnd$)
  local rnd$(length) : static rnd, seed
  for l = 1 to length
    if (mid$(rnd$,l,1) = "-") then rnd$ = left$(rnd$,l-1) + " " + right$(rnd$,length-l)
    else rnd$ = left$(rnd$,l-1) + str$(9-val(mid$(rnd$,l,1))) + right$(rnd$,length-l)
    fi
  next l
  seed = ran(rnd) : if (seed < 1) seed = range + 1
  random = token(rnd$, rnd$())
  for r = 1 to random rnd = val(rnd$(r)) + rnd next
  rnd = ran(rnd) / ran(seed) : return range*frac(rnd)
end sub
[/font]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Matrix Effect
« Reply #1 on: March 08, 2007 »
Nice one :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Paul

  • Pentium
  • *****
  • Posts: 1490
  • Karma: 47
    • View Profile
Re: Matrix Effect
« Reply #2 on: March 08, 2007 »
cool!
I will bite you - http://s5.bitefight.se/c.php?uid=31059
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Matrix Effect
« Reply #3 on: March 08, 2007 »
Cheers nice to see that you guys like this

Challenge Trophies Won: