Scrolling Text by andy_rocks24 725th Feb 2005 14:05
|
---|
Summary This is a function i created that creates a simple scrolling text Description This function will create scrolling text within an invisible box.(Like those advertising boards) Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com REM Project: scrolling text REM Created: 25/02/2005 16:38:20 REM Created by: Andrew Solesbury Rem REM ***** Main Source File ***** REM Remstart This function will create a simple scrolling text I used it to scroll text on a desktop CD Player, like the really expensive hifi's!!! In order for it to loop you must call it as below: s=scrolltext(y#,lx#,rx#,text$,s,spd,tsize,tfont$) this is because it will then call on s to reposition the text once it has scrolled past the screen the varibles are as follows: y# - the y co-ordinate on the screen lx# - the left hand x co-ordindate within which the text will scroll rx# - the right hand x co-ordindate within which the text will scroll text$ - is the actual text you want to scroll eg. "Hello Andy" ps. remember to use the inverted comma's otherwise it will not call the string! s - a varible required to loop the scroll and cause the text to move call it as shown above and it'll work, otherwise it will just go past once! spd - the speed at which to scroll the text, use somewhere between 1 and 2 to keep it readable tsize - the point size of the text tfont$ - the font name eg. "Ariel" ps. remember to use the inverted comma's otherwise it will not call the string! have fun and i hope this comes in usefull if you wish to contact me my email is andy_rocks@btinternet.com i would feel proud if you used this in a program/game but i would like to know if you do!(i cant be proud if i don't know!) Remend sync on sync rate 60 set display mode 800,600,32 backdrop on do s=scrolltext(50,50,250,"How to Use Basic String Varibles to create scrolling text",s,1.5,20,"Ariel") sync loop function scrolltext(y#,lx#,rx#,text$,s,spd,tsize,tfont$) set text size tsize set text font tfont$ x1#=rx# x1#=x1#-s for ch#=1.0 to len(text$) if x1#<=rx# if x1#>lx# text x1#,y#,mid$(text$,ch#) endif endif x1#=x1#+text width(mid$(text$,ch#)) next ch# if x1#<=lx# s=0 endif s=s+spd endfunction s |