TGC Codebase Backup



Flying text characters by MonoCoder

13th Dec 2005 12:52
Summary

Simple code that, with maybe some tweeking to make the letters settle faster, could be used in a program.



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Sync On
Sync Rate 0

Dim Chars#(1400,6)
Dim Chars$(1400)

remstart
Chars#(,1) current x pos
Chars#(,2) current y pos
Chars#(,3) final x pos
Chars#(,4) final y pos
Chars#(,5) x speed
Chars#(,6) y speed
chars$()  letter
remend

message$="Replace this message with whatever you like..."
sw=screen width()
sh=screen height()

x=20
y=0
messagepoint=1
For n=1 to 1400
If (mid$(message$,messagepoint)=" " and x=20)=0
Chars$(n)=mid$(message$,messagepoint)
Chars#(n,1)=-400+rnd((sw+400))
Chars#(n,2)=-400+rnd((sh+400))
Chars#(n,3)=x
Chars#(n,4)=y
x=x+7
If x=>sw-80 and mid$(message$,n)=" " or x=>sw-20
x=20
y=y+11
Endif
Endif
messagepoint=messagepoint+1
Next n



Do

rem update position of characters and draw to screen
For n=1 to 1400
If chars$(n)<>" " and chars$(n)<>""
If Chars#(n,1)<Chars#(n,3)
Chars#(n,5)=Chars#(n,5)+0.1
If Chars#(n,5)<0 then Chars#(n,5)=Chars#(n,5)+0.04
Endif
If Chars#(n,2)<Chars#(n,4)
Chars#(n,6)=Chars#(n,6)+0.1
If Chars#(n,6)<0 then Chars#(n,6)=Chars#(n,6)+0.04
Endif
If Chars#(n,1)>Chars#(n,3)
Chars#(n,5)=Chars#(n,5)-0.1
If Chars#(n,5)>0 then Chars#(n,5)=Chars#(n,5)-0.04
Endif
If Chars#(n,2)>Chars#(n,4)
Chars#(n,6)=Chars#(n,6)-0.1
If Chars#(n,6)>0 then Chars#(n,6)=Chars#(n,6)-0.04
Endif
Chars#(n,1)=Chars#(n,1)+Chars#(n,5)
Chars#(n,2)=Chars#(n,2)+Chars#(n,6)
If Chars#(n,1)=>Chars#(n,3)-1.4 and Chars#(n,2)=>Chars#(n,4)-1.4 and Chars#(n,1)=<Chars#(n,3)+1.4 and Chars#(n,2)=<Chars#(n,4)+1.4 and Chars#(n,5)=>-0.14 and Chars#(n,6)=>-0.14 and Chars#(n,5)=<0.14 and Chars#(n,6)=<0.14
Chars#(n,1)=Chars#(n,3)
Chars#(n,2)=Chars#(n,4)
Chars#(n,5)=0
Chars#(n,6)=0
Endif
Text Chars#(n,1),Chars#(n,2),chars$(n)
Endif
Next n

If mouseclick()=1
If mclick=0
For n=1 to 1400
Chars#(n,5)=Chars#(n,5)*1.05
Chars#(n,6)=Chars#(n,6)*1.05
Next n
Endif
mclick=1
Else
mclick=0
Endif

Sync
Cls 0
Loop