Dark Bit Factory & Gravity

PROGRAMMING => Other languages => Yabasic => Topic started by: Clanky on December 12, 2006

Title: Little Demo
Post by: Clanky on December 12, 2006
not very long, but then again, not very good!  ::)
lol! don't know what attracts me to like this demo?
hope you enjoy.

EDIT: Changed the bit with the 3 line commands... duh! To one triangle command... much neater!
         Also, you can change the TRI value to change the amount of triangle being displayed...


'Black and White Tri Scroller
'Coded by Sir Johnah

open window 640,512

tri=100

dim x1(tri),y1(tri),x2(tri),y2(tri),x3(tri),y3(tri)

  for i=1 to tri
    x1(i)=ran(640):y1(i)=ran(512)
    x2(i)=ran(640):y2(i)=ran(512)
    x3(i)=ran(640):y3(i)=ran(512)
  next i

label loop
  setdrawbuf db
  db=1-db
  setdispbuf db
  clear window
  for i=1 to tri
    y1(i)=y1(i)+6
    y2(i)=y2(i)+6
    y3(i)=y3(i)+6
    if y1(i)>=512 then:y1(i)=0:x1(i)=ran(640):fi
    if y2(i)>=512 then:y2(i)=0:x2(i)=ran(640):fi
    if y3(i)>=512 then:y3(i)=0:x3(i)=ran(640):fi
    fill triangle x1(i),y1(i) to x2(i),y2(i) to x3(i),y3(i)
    j=1-j
    setrgb 1,250*j,250*j,250*j
    triangle x1(i),y1(i) to x2(i),y2(i) to x3(i),y3(i)
  next i
goto loop
Title: Re: Little Demo
Post by: Shockwave on December 12, 2006
Makes me think of broken window panes :) Nice one.
Title: Re: Little Demo
Post by: Jim on December 13, 2006
Argh!  My eyes.  My hangover...

Nice effect.

Jim
Title: Re: Little Demo
Post by: Galileo on September 05, 2014
It is a stunning effect. And with so few lines of code!  :clap: