matrix text
Author |
Message |
shoobyman
![](http://compsci.ca/v3/uploads/user_avatars/1894631788463006b596f19.gif)
|
Posted: Tue Nov 21, 2006 6:42 pm Post subject: matrix text |
|
|
some basic matrix text. I think its cool
code: |
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
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
DKNiGHTX
![](http://img168.imageshack.us/img168/6264/zoomshockdn5hc2.gif)
|
Posted: Tue Nov 21, 2006 8:25 pm Post subject: (No subject) |
|
|
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 ) |
|
|
|
|
![](images/spacer.gif) |
ericfourfour
|
Posted: Tue Nov 21, 2006 8:37 pm Post subject: (No subject) |
|
|
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
code: | num := Rand.Int (1, 10) |
This following chunk of code is written twice. Instead put it into a procedure and call the procedure twice,
code: | 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 |
|
|
|
|
|
![](images/spacer.gif) |
wtd
|
Posted: Wed Nov 22, 2006 2:54 am Post subject: (No subject) |
|
|
ericfourfour wrote: code: | 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.
code: | 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. |
|
|
|
|
![](images/spacer.gif) |
Shyfire
![](http://img455.imageshack.us/img455/6945/pooptasticx1hn.jpg)
|
Posted: Wed Nov 22, 2006 10:09 pm Post subject: (No subject) |
|
|
great job i like it
but....
wtd has a very good point |
|
|
|
|
![](images/spacer.gif) |
lilmizeminem
![](http://compsci.ca/v3/uploads/user_avatars/1562459543463b55c691e28.jpg)
|
Posted: Thu May 24, 2007 11:03 am Post subject: 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 |
|
|
|
|
![](images/spacer.gif) |
Tallguy
![](http://compsci.ca/v3/uploads/user_avatars/515706924539b443d32a6e.gif)
|
Posted: Thu May 24, 2007 11:58 am Post subject: Re: matrix text |
|
|
DUDE,this is so tripey, its pretty cool ![Surprised Surprised](http://compsci.ca/v3/images/smiles/icon_surprised.gif) |
|
|
|
|
![](images/spacer.gif) |
StealthArcher
![](http://compsci.ca/v3/uploads/user_avatars/18949255664b176c4f1481b.jpg)
|
Posted: Thu May 24, 2007 12:09 pm Post subject: RE:matrix text |
|
|
Major necromancy going on here... |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
MichaelM
![](http://compsci.ca/v3/uploads/user_avatars/12659996144661c8396f23c.jpg)
|
Posted: Thu Jun 07, 2007 6:33 pm Post subject: Re: matrix text |
|
|
woa ![Shocked Shocked](http://compsci.ca/v3/images/smiles/icon_eek.gif) |
|
|
|
|
![](images/spacer.gif) |
|
|