TGC Codebase Backup



Useful Typewriter Effect by cguy

3rd Aug 2009 1:31
Summary

This program is simple and short, but it covers a variety of useful topics that beginners can take advantage of such as: text font and size change functions finite loops text m



Description

Please don't just copy and paste this. It isn't worth it because it's so simple, even someone who is a complete beginner can understand it, which is exactly the idea. I recommend TDK's beginner tutorials if you have trouble with it. As I am still pretty new to programming, and I still refer to it all the time.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    REM USEFUL TYPEWRITER EFFECT
REM 3 AUGUST 2009

set display mode 1280,800,16  `sets the display mode of the screen

set text size 22  `a decent size
set text font "arial"   `a clear font

typewriter("Useful Typewriter Effect!",150)  `you can change both of these options
wait key `press a key to end the program
end   `so you don't run into a function declaration in mid program.

function typewriter(text$,speed) `initiates the typewriter function for a command that lets you control the text and speed
   for a=1 to len(text$)   `starts a for-next loop, repeats for each letter in the text
      text 0,0,left$(text$,a) `a new letter appears on the screen depending on the value of 'a'
      wait speed  `the wait bettween apearances of letters
   next a   `end of loop
endfunction `end of function