I was looking for a program that I could use to teach my daughter how we use math in programming (hoping to spark some interest!) and I thought that a Falling text code would be nice, so I looked for falling text threads and found only one here:
http://forum.thegamecreators.com/?m=forum_view&t=55283&b=6 but the first example would not work for me no matter what I did and the second while it worked was very sloooow! so I took the example and went into my cave and came out a little later with this code. it's not screaming fast but it's better than it was and I have a few ideas on how to make it faster, which I will try later down the road. for now this is what I got and if you have ideas to make it better or faster please let me know!
rem *******************************
rem * Created by Jon Ericson *
rem * AKA the Angry Kreyon *
rem *******************************
rem * August 27,2007 *
rem *******************************
rem * parts of Code borrowed *
rem * from SVEN B - Original Link ********************************
rem * http://forum.thegamecreators.com/?m=forum_view&t=55283&b=6 *
rem **************************************************************
sync on : sync rate 0
hide mouse : sH=screen height() : sW=screen width() : set cursor sW /2,sH /2
set text font "symbol" : set text to bold : set text size 18
dim x(20)
dim y(20)
for i = 1 to 20
y(i) = 0
x(i) = rnd(screen width())
next i
randomize 255
do
drop(rnd(2),800/rnd(66))
loop
function drop(H,W)
ink rgb(0,255,0),rgb(0,0,0)
`center text sW /2,10,"unlock code Set." : sync
x(i) = rnd(screen width() )
for i = 1 to 20
for c = 1 to 35
ink rgb(0,255-(c*5),0),rgb(0,0,0)
center text x(i),y(i),chr$(192+rnd(61)):sync
center text x(i),y(i),chr$(rnd(255)):sync
center text x(i)*0.2,y(i),chr$(192+rnd(21)):sync
center text x(i)*0.6,y(i),chr$(rnd(61)):sync
center text x(i)/0.2,y(i),chr$(rnd(200)):sync
center text x(i)/0.6,y(i),chr$(192+rnd(161)):sync
if y(i) > screen height()
x(i) = rnd(screen width() )
y(i) = 0 - rnd(screen height() )
else
`x(i) = rnd(screen width() )
y(i) = y(i) + 18
endif
if scancode() = 25
`cls
drop(1,rnd(W))
endif
if scancode()=1 then exit
next c
fade bitmap 0,98
`flip bitmap 0
`mirror bitmap 0
next i
flip bitmap 0
mirror bitmap 0
`blur bitmap 0,3
ink rgb(0,255,0),rgb(0,0,0)
endfunction
on my machine while testing I had the project settings setup the screen as a 600x800 window and it seems to work pretty good, I have tried full screen as well and it just looks so big! the speed increase is due to a couple things, the fact that I am placing 6 lines at a time and also adding a second for/next statement (don't know why it started to go faster but it did! just try and take out the "for c =" and it's "next c" and see how much slower it really goes, I was suprised!)
anyway as it cycles through the loops, it flips and mirrors the bitmap it draws to, which gives an interesting effect.
attached is a screenie and I will probably work on this mre this week to try and get it faster and more robust!
Thanks to SVEN B for the initial code I used to start this with!