
-----------------------------------
shoobyman
Tue Nov 21, 2006 6:42 pm

matrix text
-----------------------------------
some basic matrix text.  I think its cool


View.Set ("offscreenonly")
var symbol : array 1 .. 300 of string
var symx, symy, symspeed : array 1 .. 300 of int
var font1, font2, font3, font4, symrand : int

for i : 1 .. 300
    randint (symrand, 1, 5)
    if symrand = 1 then
        symbol (i) := "M"
    elsif symrand = 2 then
        symbol (i) := "Y"
    elsif symrand = 3 then
        symbol (i) := "Z"
    elsif symrand = 4 then
        symbol (i) := "X"
    elsif symrand = 5 then
        symbol (i) := "E"
    end if
    randint (symx (i), 1, maxx)
    randint (symy (i), maxy, maxy + maxy)
    randint (symspeed (i), 5, 10)
end for

font1 := Font.New ("Copperplate Gothic Bold:5:bold")
assert font1 > 0
font2 := Font.New ("sans serif:18:bold")
assert font2 > 0
font3 := Font.New ("mono:9")
assert font3 > 0
font4 := Font.New ("Palatino:24:bold,italic")
assert font4 > 0

loop
    View.Update
    delay (10)
    cls
    drawfillbox (0, 0, maxx, maxy, 7)
    for i : 1 .. 300
        Font.Draw (symbol (i), symx (i), symy (i), font1, 10)
        Font.Draw (symbol (i), symx (i), symy (i) + 15, font1, 2)
        if symspeed (i) > 6 then
            Font.Draw (symbol (i), symx (i), symy (i) + 30, font1, 144)
        end if
        symy (i) -= symspeed (i)
        if symy (i) < -35 then
            randint (symrand, 1, 5)
            if symrand = 1 then
                symbol (i) := "M"
            elsif symrand = 2 then
                symbol (i) := "Y"
            elsif symrand = 3 then
                symbol (i) := "Z"
            elsif symrand = 4 then
                symbol (i) := "X"
            elsif symrand = 5 then
                symbol (i) := "E"
            end if
            randint (symx (i), 1, maxx)
            randint (symy (i), maxy, maxy + maxy)
            randint (symspeed (i), 5, 10)
        end if
    end for
end loop


-----------------------------------
DKNiGHTX
Tue Nov 21, 2006 8:25 pm


-----------------------------------
Hah!  I was just making one of these in computer class, but this one totally owns mine!  I never thought of doing it the way you did.  Nice ;)  (If you change 300 to 1000 and setscreen it to graphics:max;max its perplexing ;))

-----------------------------------
ericfourfour
Tue Nov 21, 2006 8:37 pm


-----------------------------------
First of all, stay away from randint. I have no clue why it is still taught in school or even included in the Turing programming language. Instead use
num := Rand.Int (1, 10)

This following chunk of code is written twice. Instead put it into a procedure and call the procedure twice,
for i : 1 .. 300
    randint (symrand, 1, 5)
    if symrand = 1 then
        symbol (i) := "M"
    elsif symrand = 2 then
        symbol (i) := "Y"
    elsif symrand = 3 then
        symbol (i) := "Z"
    elsif symrand = 4 then
        symbol (i) := "X"
    elsif symrand = 5 then
        symbol (i) := "E"
    end if
    randint (symx (i), 1, maxx)
    randint (symy (i), maxy, maxy + maxy)
    randint (symspeed (i), 5, 10)
end for

-----------------------------------
wtd
Wed Nov 22, 2006 2:54 am


-----------------------------------
    if symrand = 1 then
        symbol (i) := "M"
    elsif symrand = 2 then
        symbol (i) := "Y"
    elsif symrand = 3 then
        symbol (i) := "Z"
    elsif symrand = 4 then
        symbol (i) := "X"
    elsif symrand = 5 then
        symbol (i) := "E"
    end if

Additionally, this conditional is utterly unnecessary.  It can easily be avoided by thinking about the logic going on.

var possible_letters : string := "MYZXE"
symbol (i) := possible_letters (Rand.Int (1, 5))

Or, in keeping with the conditional, but simpler, you may wish to employ a "case" statement.

-----------------------------------
Shyfire
Wed Nov 22, 2006 10:09 pm


-----------------------------------
great job i like it 
but....
wtd has a very good point

-----------------------------------
lilmizeminem
Thu May 24, 2007 11:03 am

RE:matrix text
-----------------------------------
this is actually cool.
i know that no one has posted on this for a while..
but i just saw this now llol

-----------------------------------
Tallguy
Thu May 24, 2007 11:58 am

Re: matrix text
-----------------------------------
DUDE,this is so tripey, its pretty cool :o

-----------------------------------
StealthArcher
Thu May 24, 2007 12:09 pm

RE:matrix text
-----------------------------------
Major necromancy going on here...

-----------------------------------
MichaelM
Thu Jun 07, 2007 6:33 pm

Re: matrix text
-----------------------------------
woa :shock:
