Computer Science Canada

[source code] Text Effects

Author:  Tony [ Sun Sep 01, 2002 7:07 pm ]
Post subject:  [source code] Text Effects

I've seen a lot of people trying to make RPG games in turing and some turned out quite nice actually. As Dan about QFTB, he has it posted somewhere.

Most of typical RPGs have plots (atleast they should) and chats with other NPCs. Basically you'll end up displaying a lot of text. In this post I will be posting source codes for different text effects that you can use throughout your games and other applications.

Author:  Tony [ Sun Sep 01, 2002 7:21 pm ]
Post subject:  Displaying text

This is the simpliest way to display text information on the screen:

code:
put "your text here"

if you didn't know that already... well you've got a long way to go.

Here's a better way to display your text -- Font.Draw

code:
var fontID:int := Font.New ("Arial:14:bold")
Font.Draw("Your text here", x,y, fontID, colour)


A bit of explanation -- fontID is a variable that stores information about the font you're using. It has to be an 'int' but can be assigned a value only through Font.New as in example. Arial is the name of the font you're using, if the name doesn't match with anything on computer, the default one is used. 14 stands for the size, you can change it to any integer number. 'bold' makes text bold and is optional. You can also add :italic and/or :underline if you want.
"Your text here" is the text that will be displayed, it can be a string variable. x and y are the coordinates of the lower-left corner where text starts. fontID is the name of the variable decleared earlier. colour is the color of the text to be displayed - place an integer value or a predefined keyword for color.

Author:  Tony [ Sun Sep 01, 2002 7:36 pm ]
Post subject:  Text Delay

Text Delay is the simpliest text effect. What it does is it delays the time between each character being displayed, making it look like the text is being typed while you're reading it. Very useful, especially for games where a lot of text is displayed like RPG.

code:
procedure TextDelay(text:string)
for i : 1..length(text)
put text(i)..
delay(50)
end for
end TextDelay

var text:string
get text:*
TextDelay(text)


I bit of explanation here -- TextDelay is a procedure. This way you can use it again and again in your code just like you use "put" command.

"text" is the name of the string variable passed into the procedure. Then a forloop is run from 1 to the total number of charactes in the string. It is displayed 1 character at a time followed by a delay(50). If you increase the number, text will be typed slower, decrease it to display it quicker.

Note: after putting each character don't forget '..' to keep them all on 1 line and when getting a text string, don't forget to put ':*' to get all the characters including spaces.

And ofcourse you can just put plain text instead of the variable if you already know what to display Wink
code:
TextDelay("hello world!")

Author:  Tony [ Sun Sep 01, 2002 7:50 pm ]
Post subject:  TextDelay -- Coloured

If you didn't know before, text from 'put' command can be colored as well as text from Font.Draw using color(i:int) and colorback(i:int)

code:
color(14)
colorback(1)
put "hello world!"


this will output "hello world!" in yellow color on a blue background.

Now we can take this one step further and include that in previosly shown TextDelay!

code:
procedure TextDelay(text:string)
for i : 1..length(text)
color(red)
locate(5,i)
put text(i)
delay(100)
color(blue)
locate(5,i)
put text(i)
end for
end TextDelay

var text:string
get text:*
TextDelay(text)


This works the same way as before, but at first the character is printed in red, then it turns blue as the next character is printed. If you understand simple TextDelay, you should understand how this one works too.

Note: This procedure uses locate to output this text. In 'locate(5,i)' 5 stands for the row where text will be outputed and should be changed to achive desired results. You should not change 'i' since its the counter for the characters being displayed.

Author:  Tony [ Sun Sep 01, 2002 8:46 pm ]
Post subject:  3D text

Here's something new for you guys -- text in 3D!

Here's the code, take a look

code:
var size:int
var text:string
put "enter text"
get text:*
put "enter size"
get size


var fontID : array 1 .. size of int

for i:size div 2 .. size
fontID(i):=Font.New("Arial:"+intstr(i))
end for

procedure Text3D(text:string)

for t:1..length(text)

for i:size div 2 .. size
Font.Draw(text(t), t*size, 100, fontID(i),20+ floor(i/size*10))
end for

end for

end Text3D

Text3D(text)


Now a bit about how this thing works... variable size is the final size of the text that will be outputed. text is the variable for the... TEXT to be outputed. fontID is just like before is used as a font ID. Though this time its an array since we need many different fonts. Each font is of a different size from small to large. Puting those fonts on top of each other will make text look 3D, here's how:

the main body runs 2 forloops. "for t" runs to count each character in the text to be outputed. "for i" puts fonts from half the size to full size on top of each other.

t*size gives us a value of character position times the final size of the font. that gives a good estimate of spacing between letters. You could adjust that number to finetune spacing for specific fonts.

The color is the tricky part. The idea behind the raycasting is to go from darker to lighter color depending on the distance. this piece of code "20+ floor(i/size*10)" will evenly destribute numbers from 20 to 30 over whatever size you chouse. Numbers 20 to 30 corespond with the gridient from black to white in turing and is the easiest one to use to make it look 3D.

Since the fontID array is decleared based on the size of text desired and is outside of procedure, this effect is generally one time use. If for some crazy reason you would need to use this as often as 'put' command, I'm sure you can rearange the source code to suit your desire.

Author:  Tony [ Mon Sep 02, 2002 8:05 pm ]
Post subject:  Arched Text

This one took me a while... you better like it, or I'm not posting any more Wink

here's the code to make your text in a form of an arch:

NOTE: This code will only work under winoot 4.0.1 or higher because it uses a new "Pic.Rotate" feature not available in previous versions.

code:
var text:string
var fontID:int := Font.New("Arial:14")

put "enter a word"
get text:*

if length(text) rem 2 = 1
then
text:= text +" "
end if

var letter : array 1.. length(text) of int
var angle : array 1.. length(text) of int
var x : array 1..length(text) of int
var y : array 1..length(text) of int


    for i:1..length(text) div 2
    angle(i):= round(90/length(text)*(length(text)-i))
    put angle(i)
    end for

for i:1..length(text) div 2
    y(i):=round ( (length(text)div 2)*30*cosd(angle(i)) )
    x(i):=round ( (length(text)div 2)*60 - (length(text)div 2)*60*sind(angle(i)) )   

    end for
cls
for i:1..length(text)
Font.Draw(text(i), 15, 15, fontID, black)
letter(i) := Pic.New (0,0,30,30)
cls
end for


for i:1..length(text) div 2

letter(i):= Pic.Rotate(letter(i),angle(i), 15,15)
Pic.Draw(letter(i),x(i),y(i),picMerge)

end for

for decreasing i:length(text) div 2 .. 1

letter(i+length(text) div 2):= Pic.Rotate(letter(i+length(text) div 2),360-angle((length(text)div 2)-i+1), 15,15)
Pic.Draw(letter(i+length(text) div 2),x(length(text)div 2)*2-x((length(text)div 2)-i+1),y(length(text) div 2)-y(i)+30,picMerge)

end for


I really don't feel like explaining it right now... I got really frustrated couple of times today while making this.

Basically what it does is that it takes each letter drawn using Font.Draw and saves it as a picture. Then its whole bunch of trigionometry to calculate angles and position of each character to arrangle them in an arch formation.

Calculations were done for the first half and then flipped to make values for second... I run into some problems and this seemed a better way out... might not be the best solution though.

Also, that little IF statment at the beggining of the program will add an extra character if you got an odd number of characters because otherwise last one will disappear.

Also you can change the relative height and width of the arch by messing with declaration of X and Y

code:
    y(i):=round ( (length(text)div 2)*30*cosd(angle(i)) )
    x(i):=round ( (length(text)div 2)*60 - (length(text)div 2)*60*sind(angle(i)) )   


in Y, *30* is a relative height of the arch...you can change that... In X, *60 - is the center of the arch, you can move the text left and right by changing this number. The *60* part is the relative width of the arch, you can change this to make the arch wider or thiner.

This effect might be a good use for generating custom arched signs for things like park entrances or something... Who knows what kind of stuff you guys are making out there, I'm just giving you source code to use.

Author:  Mazer [ Mon Oct 07, 2002 9:56 am ]
Post subject: 

i liked the text delay with colour but it isn't that impressive since you're still stuck the the stupid turing run window font. think you could come up with a way to use that type of proc with Font.Draw? that would be impressive. don't worry about the text getting cut off i'd just like to see it done even with a few letters.

Author:  JayLo [ Thu Mar 20, 2003 7:59 pm ]
Post subject: 

yes tony. it would be impressive.

Author:  JayLo [ Thu Mar 20, 2003 8:17 pm ]
Post subject:  Font.Draw in TextDelay

here it is. not as hard as I thought.
Text Delay involving Font.Draw!
code:

var size : int
var colorText : int
var text : string
put "enter text"
get text : *
put "enter size"
get size
put "enter colour"
get colorText

var fontID : int
var text3DLetter : array 1 .. length (text) of string
fontID := Font.New ("Verdana:" + intstr (size))

procedure text3DDelay (text : string)
    for i : 1 .. length (text)
        text3DLetter (i) := text (i)
    end for
    for t : 1 .. length (text)
        Font.Draw (text3DLetter (t), t * size, maxy div 2, fontID, colorText)
        delay (50)
    end for
end text3DDelay
text3DDelay (text)



MOD EDIT: gave you some bits for this, good work. -Dan

Author:  Asok [ Thu Mar 20, 2003 9:18 pm ]
Post subject: 

Jay Lo, there are some spacing issues with your code you should address.

Author:  Tony [ Thu Mar 20, 2003 9:55 pm ]
Post subject: 

well spacing with font.draw would be my bad... I assumed that the size of a letter in pixels would equal to its size. Which is almost accurate. Atleast it would be with a fixed width font.

Author:  Catalyst [ Thu Mar 20, 2003 10:19 pm ]
Post subject: 

jus tuse Font.WIdth

Author:  Catalyst [ Thu Mar 20, 2003 10:21 pm ]
Post subject: 

here i fixed the spacing issue in ur code


code:

var size : int
var colorText : int
var text : string
put "enter text"
get text : *
put "enter size"
get size
put "enter colour"
get colorText
var buff : string := ""
var fontID : int
var text3DLetter : array 1 .. length (text) of string
fontID := Font.New ("Verdana:" + intstr (size))

procedure text3DDelay (text : string)
    for i : 1 .. length (text)
        text3DLetter (i) := text (i)
    end for
    for t : 1 .. length (text)
        Font.Draw (text3DLetter (t), 50 + Font.Width (buff, fontID), maxy div 2, fontID, colorText)
        delay (50)
        buff += text3DLetter (t)
    end for
end text3DDelay
text3DDelay (text)


Mod Edit: gave some bits for the improved code Smile - Tony

Author:  Asok [ Fri Mar 21, 2003 12:43 am ]
Post subject: 

Excellent job Catalyst!

Author:  JayLo [ Fri Mar 21, 2003 6:23 pm ]
Post subject:  lol

catalyst puts me to shame... Embarassed

Author:  Delta [ Fri Mar 21, 2003 10:55 pm ]
Post subject:  Text Effect Number 1

Types out the text
code:

procedure TypeThis (word:string, speed:int)
    for i : 1 .. length(word)
        put word(i)..
        delay (speed)
    end for
    put ""
end TypeThis

TypeThis ("Text Effect", 100)
TypeThis ("Number 1", 100)

Author:  Tony [ Fri Mar 21, 2003 11:00 pm ]
Post subject: 

isnt it the same as textDelay Confused

Author:  Delta [ Fri Mar 21, 2003 11:04 pm ]
Post subject: 

Here is the same thing just with some extras and using Font.Draw
code:

procedure TypeThis (word:string, x, y :int, size, clr, speed:int)
    var font : int := Font.New ("Arial:"+intstr(size))
    for i : 1 .. length(word)
        Font.Draw (word(1..i), x, y, font, clr)
        delay (speed)
    end for
    put ""
end TypeThis

TypeThis ("Text Effect",100, 300, 20,14, 100)
TypeThis ("Number 2", 50,100, 50,12,100)

Author:  Delta [ Fri Mar 21, 2003 11:06 pm ]
Post subject:  I'm sorry

Sorry if some of the text effects are the same I'm just posting what ever I can think of

Author:  Delta [ Fri Mar 21, 2003 11:17 pm ]
Post subject:  Text Effect Number3

Fades in text using Font.Draw
code:

procedure FadeThisIn (word:string, x, y :int, size, speed:int)
    var font : int := Font.New ("Arial:"+intstr(size))
    for decreasing i : 31 .. 16
        Font.Draw (word, x, y, font, i)       
        delay (speed)
    end for
    put ""
end FadeThisIn

FadeThisIn ("Text Effect", 300, 100, 75, 100)
FadeThisIn ("Number 3", 200, 50, 45, 500)


to fade out for i : 16 .. 31 fades from black to white

Author:  Delta [ Fri Mar 21, 2003 11:25 pm ]
Post subject:  Text Effect Number 4

Flashes the letters in the word
code:

procedure LetterFlash (word:string)
    var font : int := Font.New ("Arial:50")
    for i : 1..length(word)
        Font.Draw (word(1..i), 200, 200, font, 28)
        if i > 1 then
            Font.Draw (word(1..i-1), 200, 200, font, 0)
        end if
        delay (100)
    end for
end LetterFlash

LetterFlash ("Text Effect Number 4")

Author:  Catalyst [ Sat Mar 22, 2003 12:54 pm ]
Post subject: 

This makes the text explode and unexplode, (note for now only on a black background)
code:

setscreen ("offscreenonly,graphics:320;150,nobuttonbar")

proc ExplodeText (x0, y0 : int, text00 : string, font : int, c0 : int)
    var clr, c : int := 0
    var r, g, b : real
    RGB.GetColor (c0, r, g, b)
    for i : 1 .. 255
        clr := RGB.AddColor ((i * r) / 255, (i * g) / 255, (i * b) / 255)
    end for
    type Particle :
        record
            x, y, xV, yV : real
            life, c : int
        end record

    drawfillbox (0, 0, maxx, maxy, 7)
    var text : string := text00
    Font.Draw (text, x0, y0, font, c0)
    var screen : array 1 .. maxx, 1 .. maxy of int
    const numP := 200
    const maxLife := 25
    var main : flexible array 1 .. 1 of Particle
    for x : 1 .. maxx
        for y : 1 .. maxy
            if whatdotcolor (x, y) = c0 then
                c += 1
                new main, c
                main (c).x := x
                main (c).y := y
                main (c).xV := Rand.Int (-5, 5) * Rand.Real
                main (c).yV := Rand.Int (-5, 5) * Rand.Real
                main (c).life := maxLife
                main (c).c := whatdotcolor (x, y)
            end if
        end for
    end for
    loop
        for i : 1 .. c
            main (i).x += main (i).xV
            main (i).y += main (i).yV
            main (i).life -= 1
            if main (i).life > 0 then
                drawdot (round (main (i).x), round (main (i).y), round ((main (i).life / maxLife) * 255) + 255)
            end if
        end for
        View.Update
        drawfillbox (0, 0, maxx, maxy, 7)
        exit when main (1).life <= 0
    end loop
end ExplodeText


proc UnExplodeText (x0, y0 : int, text00 : string, font : int, c0 : int)
    var clr, c : int := 0
    var r, g, b : real
    RGB.GetColor (c0, r, g, b)
    for i : 1 .. 255
        clr := RGB.AddColor ((i * r) / 255, (i * g) / 255, (i * b) / 255)
    end for
    type Particle :
        record
            x, y, xV, yV : real
            life : int
        end record
    drawfillbox (0, 0, maxx, maxy, 7)
    View.Update
    Font.Draw (text00, x0, y0, font, c0)
    var screen : array 1 .. maxx, 1 .. maxy of int
    const numP := 200
    const maxLife := 100
    var s : int := 100
    var main : flexible array 1 .. 1 of Particle
    for x : 1 .. maxx
        for y : 1 .. maxy
            if whatdotcolor (x, y) = c0 then
                c += 1
                new main, c
                main (c).xV := Rand.Int (-5, 5) * Rand.Real
                main (c).yV := Rand.Int (-5, 5) * Rand.Real
                main (c).x := x + (main (c).xV * s)
                main (c).y := y + (main (c).yV * s)
                main (c).xV := -main (c).xV
                main (c).yV := -main (c).yV
                main (c).life := 0

            end if
        end for
    end for
    loop
        drawfillbox (0, 0, maxx, maxy, 7)
        for i : 1 .. c
            if main (i).life < maxLife then
                main (i).x += main (i).xV
                main (i).y += main (i).yV
                main (i).life += 1
                drawdot (round (main (i).x), round (main (i).y), round ((main (i).life / maxLife) * 255) + 255)
            else
                drawdot (round (main (i).x), round (main (i).y), c0)
            end if
        end for
        View.Update
        exit when main (c).life >= maxLife
    end loop
end UnExplodeText


var font : int := Font.New ("verdana:36:bold")
loop
    ExplodeText (50, 50, "Catalyst", font, 103)
    cls
    UnExplodeText (50, 50, "Catalyst", font, 103)
    View.Update
end loop


MOD Edit: I never realized we had such awesome turing programmers here already Confused This effect by far is the best! +15Bits, I'm VERY impressed -Tony
MOD Edit: This is godly! Adding an additional +5 Bits! -Asok

Author:  Catalyst [ Sat Mar 29, 2003 1:29 am ]
Post subject: 

bored... racecar effect...

code:

View.Set ("nobuttonbar,graphics:650;100,position:300;300,offscreenonly")

var font : int := Font.New ("verdana:45:bold")
var a, c : int := 0000

var x0, y0 : int := 20

var text : string := "               Catalyst"
var buff : string := ""
var x, y : array 1 .. length (text) of int

for i : 1 .. length (text)
    x (i) := x0 + Font.Width (buff, font)
    y (i) := y0
    buff += text (i)
end for

for decreasing i : length (text) .. 1
    for k : 1 .. x (i)
        Font.Draw (text (i), k, y (i), font, 7)
        View.Update
        delay (1)
        Font.Draw (text (i), k - 2, y (i), font, 0)
    end for
    Font.Draw (text (i), x (i), y (i), font, 7)
    View.Update
    delay (50)
end for


MOD Edit: Those effects just keep on comming Very Happy +10Bits -Tony

Author:  BlAcK TuRtLe [ Mon Mar 31, 2003 7:51 pm ]
Post subject: 

Thanks for the help. Here is a primitive piece of crap I just made
code:
%Logo
Draw.Arc(200,200,50,100,0,180,yellow)
Draw.Arc(300,200,50,100,0,180,yellow)
Draw.FillBox(125,115,375,200,brightred)
Draw.Arc(200,200,25,100,0,180,yellow)
Draw.Arc(300,200,25,100,0,180,yellow)
Draw.FillMapleLeaf(370,200,400,230,red)
%Text
var y:int := Font.New ("Arial:26:bold")
Font.Draw("McDonalds",160,150,y,yellow)
delay(2000)
Draw.FillBox(125,115,375,200,brightred)
var x:int := Font.New ("Arial:14:bold")
Font.Draw("We love to see you smile",130,150,x,yellow)
delay(2000)
Draw.FillBox(125,115,375,200,brightred)
var z:int := Font.New ("Arial:14:bold")
Font.Draw("Billions served everyday",130,150,z,yellow)

Author:  Tony [ Mon Mar 31, 2003 8:18 pm ]
Post subject: 

lol, not exactly a text effect, but its still cool Wink

Author:  Catalyst [ Mon Mar 31, 2003 10:25 pm ]
Post subject: 

looked at my last post here (racecar) an got and idea...

code:

setscreen ("offscreenonly,graphics:800;150,nobuttonbar")

proc ExplodeText (x0, y0 : int, text00 : string, font : int, c0 : int)
    var clr, c : int := 0
    var r, g, b : real
    RGB.GetColor (c0, r, g, b)
    for i : 1 .. 255
        clr := RGB.AddColor ((i * r) / 255, (i * g) / 255, (i * b) / 255)
    end for
    RGB.GetColor (103, r, g, b)
    for i : 1 .. 255
        clr := RGB.AddColor ((i * r) / 255, (i * g) / 255, (i * b) / 255)
    end for
    type Particle :
        record
            x, y, xV, yV : real
            life, c, trig : int
        end record

    drawfillbox (0, 0, maxx, maxy, 7)
    var text : string := text00
    Font.Draw (text, x0, y0, font, c0)
    var screen : array 1 .. maxx, 1 .. maxy of int
    const numP := 200
    const maxLife := 75
    var main : flexible array 1 .. 1 of Particle
    for x : 1 .. maxx
        for y : 1 .. maxy
            if whatdotcolor (x, y) = c0 then
                c += 1
                new main, c
                main (c).x := x
                main (c).y := y
                main (c).xV := +5
                main (c).yV := 0
                main (c).life := maxLife
                main (c).c := whatdotcolor (x, y)
                main (c).trig := 0
            end if
        end for
    end for
    loop
        for i : 1 .. c
            main (i).x += main (i).xV
            main (i).y += main (i).yV
            if main (i).x >= 750 and main (i).trig = 0 then
                main (i).trig := 1
                main (i).xV := (main (i).xV * -1) * Rand.Real
                main (i).yV := Rand.Int (-5, 5) * Rand.Real
            end if
            if main (i).trig = 1 then
                main (i).life -= 1
                main (i).yV-=0.05
            end if
            if main (i).life > 0 then
                if main (i).trig = 0 then
                    drawdot (round (main (i).x), round (main (i).y), round ((main (i).life / maxLife) * 255) + 255)
                else
                    drawdot (round (main (i).x), round (main (i).y), round ((main (i).life / maxLife) * 255) + 510)
                end if
            end if
        end for
        View.Update
        drawfillbox (0, 0, maxx, maxy, 7)
    end loop
end ExplodeText

var font : int := Font.New ("verdana:36:bold")
ExplodeText (210, 50, "Catalyst", font, 103)

Author:  Catalyst [ Mon Mar 31, 2003 10:28 pm ]
Post subject: 

this happened to come about when i was making the last one...

(altho i dont need to for some reason i still use particles)
code:

setscreen ("offscreenonly,graphics:800;150,nobuttonbar")

proc ExplodeText (x0, y0 : int, text00 : string, font : int, c0 : int)
    var clr, c : int := 0
    var r, g, b : real
    RGB.GetColor (c0, r, g, b)
    for i : 1 .. 255
        clr := RGB.AddColor ((i * r) / 255, (i * g) / 255, (i * b) / 255)
    end for
    type Particle :
        record
            x, y, xV, yV : real
            life, c : int
        end record

    drawfillbox (0, 0, maxx, maxy, 7)
    var text : string := text00
    Font.Draw (text, x0, y0, font, c0)
    var screen : array 1 .. maxx, 1 .. maxy of int
    const numP := 200
    const maxLife := 25
    var main : flexible array 1 .. 1 of Particle
    for x : 1 .. maxx
        for y : 1 .. maxy
            if whatdotcolor (x, y) = c0 then
                c += 1
                new main, c
                main (c).x := x
                main (c).y := y
                main (c).xV := +5
                main (c).yV := 0
                main (c).life := maxLife
                main (c).c := whatdotcolor (x, y)
            end if
        end for
    end for
    loop
        for i : 1 .. c
            main (i).x += main (i).xV
            main (i).y += main (i).yV
            if main (i).x < 200 and main (i).life < maxLife then
                main (i).life += 1
            end if
            if main (i).x > 600 then
                main (i).life -= 1
            end if
            if main (i).x >= 800 then
                main (i).x -= 900
            end if
            if main (i).life > 0 then
                drawdot (round (main (i).x), round (main (i).y), round ((main (i).life / maxLife) * 255) + 255)
            end if
        end for
        View.Update
        drawfillbox (0, 0, maxx, maxy, 7)
    end loop
end ExplodeText

var font : int := Font.New ("verdana:20:bold")
ExplodeText (210, 50, "Catalyst - It's a Marquee...", font, 103)

Author:  Tony [ Mon Mar 31, 2003 10:59 pm ]
Post subject: 

Very Happy AWESOME... just AWESOME.

+20Bits ofcourse... each Wink

Author:  Tony [ Sat Apr 05, 2003 3:36 pm ]
Post subject: 

Count-Down Very Happy

Note: This text effect works only in v4+ compilers because of View.Update. The effect will work in v3 if View.Update is removed, but it will flicker. If you want to use it in v3 anyway, atleast get rid of cls to reduce flicker amount.

code:

procedure CountDown(numFrom,numTo,speed:int)

View.Set("offscreenonly") %flicker free animation, v4 compiler only
var fontID:array 1..ceil(maxy*1.5) of int %declear variables for fonts

for i:1..ceil(maxy*1.5)
fontID(i):= Font.New("arial:"+intstr(i)) %declearing fonts of sizes we need
end for

for decreasing num:numFrom..numTo %starting count down loop

for i:1..ceil(maxy*1.5) by speed %starting loop for zooming numbers in
Font.Draw(intstr(num),round(maxx/2 - i/3 - Font.Width(intstr(num),fontID(i))/4),round(maxy/2-i/2),fontID(i),round(17+i/ceil(maxy*1.5)*13))
%just draws the number where its suppost to be, X,Y,Color
View.Update %updates image
cls %clears screen
end for

end for

View.Set("nooffscreenonly") %disable offscreenonly and returns to previous mod

for i:1..ceil(maxy*1.5)
Font.Free(fontID(i)) %clean up after ourselves
end for

end CountDown %and we're done


%now to call the procedure and test it out.
%arguments are:
%Count down from: int
%Count down to: int
%Speed :int ~ larger num = faster countdown
CountDown(10,1,10)


Counts down from/to numbers your specify. Good for the start of the "movie" or whenever you need to count down to something.

Also this procedure is screen-size independant. Meaning it would work properly in any screensize of your program.

Note: if you count in single digits only, you can take out
code:
- Font.Width(intstr(num),fontID(i))/4
Its there just to fix positioning of 2 digit numbers.

Author:  void [ Mon Apr 07, 2003 6:34 pm ]
Post subject:  patch

is there a patch i can get for v3 to run v4 programs because i really dont feel like paying money for v4 but all these neat effects require v4 because of the one line that all of them use "View.Update" Evil or Very Mad if anyone knows of any site where i can in theory "GET" this v4 of winOOT...a link would be much appreciated or a link to a patch..(my skools too cheap for v4)

Author:  Dan [ Mon Apr 07, 2003 7:03 pm ]
Post subject: 

i do not bilve there is a pach for 3.1.1 to 4.X . Also the only site i know of that has pachs for turing is holths site.

Author:  haujobb [ Tue Apr 15, 2003 9:28 am ]
Post subject: 

Didn't see this anywhere else so...

code:

var intTextLength : int := 0
var realTextLength : int := 0
var where : int := 0
var text : string := " "

procedure textCenter (text : string, where : int)
    intTextLength := length (text)
    realTextLength := intTextLength / 2
    intTextLength := round (realTextLength)
    locate (where, 60 - intTextLength)
    put text
end textCenter

textCenter ("The text... is centered!", 1)


The first variable passed is the text that you want displayed and the second variable is which row you want it displayed on...

Also... the Y coordinate - in this case 60 - intTextlength - only works with the screen size I used to you might have to alter that value.

Author:  Tony [ Tue Apr 15, 2003 10:09 am ]
Post subject: 

if you replace 60 with maxcol it would work for any window size Wink


Also, there is no patch from v3 to v4 since v4 was rewriten from scrach.

You can take out View.Update and View.Set("offscreenonly") as the rest of the code should be compatible with v3. The only downside is flashing.

Author:  haujobb [ Tue Apr 15, 2003 10:16 am ]
Post subject: 

60 is the center of the screen, so it would be maxcol \ 2.

Good idea tho, I'm gonna use that now...

Author:  Blade [ Sat Apr 19, 2003 3:01 pm ]
Post subject: 

tony wrote:
if you replace 60 with maxcol it would work for any window size Wink


Also, there is no patch from v3 to v4 since v4 was rewriten from scrach.

You can take out View.Update and View.Set("offscreenonly") as the rest of the code should be compatible with v3. The only downside is flashing.


so thats why sprites dont work in 4.... wierd stuffs..

Author:  Blade [ Thu May 22, 2003 11:22 am ]
Post subject: 

here's my 2 cents worth of text effect Smile it might help some though because there was a question in turing help forum

code:
var x : int := 100
const y := 100
var font : int := Font.New ("Arial:30")
procedure drawword (word : string (30), del : int)
    for i : 1 .. length (word)
        Font.Draw (word (i), x, y, font, black)
        delay (del)
        x += Font.Width (word (i), font)
    end for
    x := 100
    for i : 1 .. length (word)
        Font.Draw (word (i .. *), x, y, font, black)
        delay (del)
        x += Font.Width (word (i), font)
        cls
    end for
    cls
end drawword

drawword ("WAAAZZZAAAP???", 100)
- hope it helps someone

MOD EDIT: Fixed some typos so it actually works. -Asok

Author:  AsianSensation [ Sun Jul 20, 2003 12:28 pm ]
Post subject: 

One more text effect....

3D(sort of) text rising


code:
View.Set ("offscreenonly")
var fontID := Font.New ("Ariel:50:Bold")
var x, y := 50
for rep : 1 .. 15
    Font.Draw ("Hello", x, y + rep, fontID, 16)
    delay (50)
    View.Update
    if rep not= 15 then
        Font.Draw ("Hello", x, y + rep, fontID, 20)
    end if
end for


I got this idea when I was looking back at my midterm mario rpg game. It works the same way with a picture.

readjust the delays for different computer.

Author:  AsianSensation [ Sun Jul 20, 2003 4:59 pm ]
Post subject: 

here is a better version of the above one, more 3D-ish...

code:
View.Set ("offscreenonly")
var clr : int
const depth : int := 15
var counter := 256 + depth
var fontID := Font.New ("Ariel:50:Bold")
var x := (maxx - Font.Width ("AsianSensation", fontID)) div 2 + depth
var y := 200

for rep : 1 .. depth + 1
    clr := RGB.AddColor (1, rep / (depth + 1), 1)
end for

for rep : 1 .. depth
    Font.Draw ("AsianSensation", x - rep, y + rep, fontID, purple)
    delay (50)
    View.Update
    if rep not= depth then
        Font.Draw ("AsianSensation", x - rep, y + rep, fontID, counter)
    end if
    counter -= 1
end for


Tweaking with the RGB value will give you different color displays.

Also, tweak depth for how much it rises.

Edit: Well, fixed some error, and made it look better, especially with the purple color Razz

Author:  SilverSprite [ Tue Jul 22, 2003 2:34 pm ]
Post subject: 

Sucky..

Author:  AsianSensation [ Sun Aug 10, 2003 11:51 am ]
Post subject: 

Well, time again for the AsianSensation text effect of the.....um.....month, yeah! 8)

code:
View.Set ("offscreenonly")
colorback (7)
cls

var word := "AsianSensation"
var font := Font.New ("Arial:30:Bold")
const xpos := 200
const ypos := 100

var dot : array xpos .. xpos + Font.Width (word, font), ypos .. ypos + 30 of int

var clr : int
const width := Font.Width (word, font)

for decreasing rep : width .. 0
    clr := RGB.AddColor (rep / (width), rep / (width), rep / (width))
end for
clr := RGB.AddColor (0, 0, 0)
var clrc := maxcolor

Font.Draw (word, xpos, ypos, font, white)

for x : xpos .. xpos + Font.Width (word, font)
    for y : ypos .. ypos + 30
        if whatdotcolor (x, y) = white then
            dot (x, y) := 1
        else
            dot (x, y) := 0
        end if
    end for
end for

for x : xpos .. xpos + Font.Width (word, font)
    for y : ypos .. ypos + 30
        if dot (x, y) = 1 then
            drawdot (x, y, clrc)
            %View.Update
        end if
    end for
    clrc -= 1
end for


Text shading, I haven't seen this up here, just thought it was useful...

now all I need is a sliding shade fade for text...

maybe I'll work it out for next month 8)

Edit: lol, I realized that I spelt AsianSensation wrong, lol. I also "fixed" that outline thing, and spelt Arial correctly, lol

Author:  SilverSprite [ Sun Aug 10, 2003 12:41 pm ]
Post subject: 

this is even crappier lol

Author:  PaddyLong [ Sun Aug 10, 2003 2:22 pm ]
Post subject: 

a good idea ... unfortunately it looks kind of grubby because of that outline or something lol

btw you spelt arial wrong

Author:  AsianSensation [ Mon Aug 11, 2003 9:47 am ]
Post subject: 

lol, I spelt Arial wrong, guess you found another error in the Turing help document, lol. I only copy and pasted what's on the help file.

btw, what outline are you talking about? If you mean that line that goes from left to right while shading, just comment off View.Update, and it shouldn't appear anymore.

Author:  PaddyLong [ Mon Aug 11, 2003 11:28 am ]
Post subject: 

no I mean around some of the first letters you can see a few miscoloured pixels...

Author:  Tony [ Sat Oct 04, 2003 11:05 pm ]
Post subject: 

This weekend I saw foolproof and desided to try and reprocude the text effect they have in the opening. Its basically a random line of hex numbers (well not really hex, but of 2 digit sets) that randomly rotate into the text wanted. This is what I came up with

code:

%text effect from movie "foolproof"
%programmed by Tony Targonski
%Started October 03.2003
%Finished October 04.2003

%draw procedure
procedure draw(picL1:int, picN1:int ,x:int, y:int, step:int)

var picL:int := picL1
var picLtemp:int
var picN:int := picN1
var picNtemp:int


var i:int := step

if step<=20 and step>0 then

picNtemp:=Pic.Scale(picN,21-i,20)
Pic.Draw(picNtemp,x+round(i/2),y,picMerge)
Pic.Free(picNtemp)

elsif step>20 and step<=40 then

picLtemp:=Pic.Scale(picL,i-20,20)
Pic.Draw(picLtemp,x+round((40-i)/2),y,picMerge)
Pic.Free(picLtemp)

end if

if step>40 then
Pic.Draw(picL,x,y,picMerge)
elsif step<0 then
Pic.Draw(picN,x,y,picMerge)
end if

end draw



procedure foolproof(text:string,x:int,y:int, delaytime:int)

var fontID:int := Font.New("Arial:16")

var imageN:array 1..length(text) of int %array for number images
var imageL:array 1..length(text) of int %array for letter images

var imageX:array 1..length(text) of real %array for image's X value

imageX(1):=x
%set X values
for i:2..length(text)
imageX(i):=imageX(i-1) + 15 + i mod 2 * 20
end for

for i:1..length(text)
Font.Draw(text(i),100,100,fontID,black)
imageL(i):= Pic.New(95,95,115,115) %stores each letter
cls
Font.Draw(intstr(Rand.Int(0,9)),100,100,fontID,black)
imageN(i):= Pic.New(95,95,115,115) %stores each number
cls

end for


var lstep:array 1..length(text) of int
var longest:int:=999

for i:1..length(text)
lstep(i):=Rand.Int(-100,0)
if lstep(i)<longest then
longest := lstep(i)
end if
end for


View.Set("offscreenonly")

loop

for i:1..length(text)

draw(imageL(i),imageN(i),round(imageX(i)),y,lstep(i))
lstep(i)+=1


%spreads numbers out
if i mod 2 = 0 and lstep(i) >0 and lstep(i)<40 then %even number
imageX(i) += 1/8
else %odd number
imageX(i) -= 1/8
end if

end for

View.Update
delay(delaytime)
longest+=1
exit when longest>41
cls
end loop


end foolproof


Sorry that it's not commented much. I added some key info, but I donno... if you have questions about how it works, ask. Although you dont really need to know how it works. Not unless you would want to modify hardcoded font (btw, if you're to modify font's size, you'd have to reprogram spacing as well).

Quote:

Effect's method has following format:

foolproof(text:string, x:int, y:int, delay:int

text - a string to be displayed

x/y - location of the left most letter (note, the letter will end up moving a bit to the left during spread out

delay - delay between each step during animation. The amount of calculations required makes it run normaly on my computer with 0 delay


An example of call is
code:

foolproof("foolproof",100,100,0)


Notes
- some flashing numbers before animation are to load up images of letters and numbers.

- View mod is set to "offscreenonly" during animation.

- effect uses cls. If you want to use it with background, you would need to modify that line

- two procedures are involved. draw is for drawing each letter at spesific step. foolproof is the driver that loads values and calls draw

Author:  PaddyLong [ Sun Oct 05, 2003 1:30 pm ]
Post subject: 

very cool Tony

Author:  Tony [ Mon Oct 27, 2003 11:04 pm ]
Post subject: 

yet again - another text effect from the creative mind of bored Tony Laughing

Falling Binary
code:

%Falling Binary
%Turns text string into Binary and makes bits falls,
%slowly rebuilding letters from them
%Created by: Tony Targonski on October 27, 2003
%for www.compsci.ca

procedure binaryFall (text : string, nRows : int)

    var list : array 1 .. length (text) of string %store binary
    var fontID : int := Font.New ("Arial:14")
    var number : int %here for calculations

    for i : 1 .. length (text)
        list (i) := intstr (ord (text (i)), 8, 2) %convert text to binary

        loop
            if list (i) (1) = " " then
                list (i) := list (i) (2 .. *) %remove any extra " "s
            else
                exit
            end if
        end loop

        list (i) := repeat ("0", 8 - length (list (i))) + list (i) + repeat (" ", nRows) %add any missing leading 0s and ending spaces
    end for


    for s : 1 .. nRows + 8 %for num of rows

        if s > nRows then %time to turn binary back into letters
            for i : 1 .. length (text)
                list (i) := list (i) (2 .. *) %cut leading bit off
            end for
        end if

        for i : 1 .. length (text) %for each column
            for l : 1 .. length (list (i)) %for each digit


                %this number thingy makes sure that letters dont fall below sertain level
                if s > nRows then
                    number := nRows
                else
                    number := s
                end if

                Font.Draw (list (i) (l), i * 20, maxy - number * 14 + l * 14, fontID, black)

            end for

        end for
   %     drawline (0, maxy - 10 * 14, maxx, maxy - 10 * 14, black)
       
        for i:1..length(text)
        Font.Draw(text(i),i*20,maxy-nRows*14,fontID,black)
        end for
        Draw.FillBox(0,maxy-nRows*14+14,length(text)*20+20,maxy-nRows*14+round((s-nRows)/8*13),white)
       
        View.Update
        delay (250)
        cls
    end for

    for i:1..length(text)
    Font.Draw(text(i),i*20,maxy-nRows*14,fontID,black)
    end for
    View.Update %show off text to last
   
end binaryFall


kind of documented... not really... should be straight-farward.

The binary that's falling are real binary values of text passed to the method. Reading from bottom to up.

to run the effect:
code:

View.Set("offscreenonly")
binaryFall ("tony is bored", 20)


where it's
binaryFall(text:string, number_of_rows_to_fall:int)

Author:  thoughtful [ Tue Oct 28, 2003 6:05 pm ]
Post subject:  My lame effect

This is a lame strike out effect i made. Still has some length issues.
code:

var font : int

var strike : string
procedure strikeout (word : string, x : int, y : int, fontsize : int ,delaytime:int)

    font := Font.New ("Ariel:" + intstr (fontsize))
    Font.Draw (word, x, y, font, black)
    strike := repeat ("_", length (word)- length (word) div 10 )
    if length(strike)=1 then
    Font.Draw (strike, x, y + (fontsize div 2), font, black)
    else
    for i: 1..length(strike)
    Font.Draw (strike(1..i), x, y + (fontsize div 2), font, white)
    Font.Draw (strike(1..i-1), x, y + (fontsize div 2), font, black)
    delay(delaytime)
    end for
    Font.Draw (strike, x, y + (fontsize div 2), font, black)
    end if
end strikeout


At the end try this to call the procedure
code:

strikeout ("Thoughtful", 100, 100, 20,100)

Author:  Tony [ Tue Oct 28, 2003 6:51 pm ]
Post subject: 

I'm not sure if this would help, but
code:

Font.Width(text:string, fontID:int)

might come in handy. It tells you the width of a textstring using sertain font in pixels.

Author:  thoughtful [ Tue Oct 28, 2003 7:53 pm ]
Post subject:  Thnx

Hey thnx, now the length problem is fixed using the command u gave me.
I also added custom color. But still the effect is petty lame will do a better one if got more time. Embarassed

code:

var strike : string
procedure strikeout (word : string, x : int, y : int, fontsize : int ,delaytime:int,clr:int)

    var font := Font.New ("Ariel:" + intstr (fontsize))
    Font.Draw (word, x, y, font, clr)
    strike :="_"
    loop
    exit when Font.Width(word, font)<Font.Width(strike, font)
    strike := strike+"_"
    end loop
    if length(strike)=1 then
    Font.Draw (strike, x, y + (fontsize div 2), font, clr)
    else
    for i: 1..length(strike)
    Font.Draw (strike(1..i), x-3, y + (fontsize div 2), font, white)
    Font.Draw (strike(1..i-1), x-3, y + (fontsize div 2), font, clr)
    delay(delaytime)
    end for
    Font.Draw (strike, x-3, y + (fontsize div 2), font, clr)
    end if
end strikeout
strikeout ("Thoughtful", 100, 100, 20,100,7)
strikeout ("ROCKS", 300, 300, 40,150,blue)

Author:  thoughtful [ Wed Oct 29, 2003 11:27 pm ]
Post subject:  Some other lame effects

Well i made some other lame effects, please do not draw n e thing above 300 y pixels as i m using that area as the scratch pad.
PS:= Can n e one tell me how to use the whatdotcolor functions offscreen, as in how to draw something which has a position greater than maxx or maxy and use this function, because i first tried to use that but it didnt work.

Here are the 3 effects:
code:


procedure ThoughtEffect1 (word : string, x_pos : int, y_pos : int, fontsize : int, colur : int, delay_time : int)
    var font : int := Font.New ("Batang:" + intstr (fontsize))
    var xwidth : int := Font.Width (word, font)
    var height, ascent, descent, internalLeading : int
    Font.Sizes (font, height, ascent, descent, internalLeading)
    var yheight : int := height
    var clr : array 1 .. xwidth, 1 .. yheight of int
    Font.Draw (word, 10, 300, font, colur)
    for x : 1 .. xwidth
        for y : 1 .. yheight
            clr (x, y) := whatdotcolor (x + 10, 300 + y - descent)
        end for
    end for
    drawfillbox (10, 298, 10 + xwidth, 300 + yheight, white)
    for x : 1 .. xwidth
        for y : 1 .. yheight
            drawdot (x + x_pos, y + y_pos, clr (x, y))
        end for
        delay (20)
    end for
end ThoughtEffect1
procedure ThoughtEffect2 (word : string, x_pos : int, y_pos : int, fontsize : int, colur : int, delay_time : int)
    var font : int := Font.New ("Times New Roman:" + intstr (fontsize))
    var xwidth : int := Font.Width (word, font)
    var height, ascent, descent, internalLeading : int
    Font.Sizes (font, height, ascent, descent, internalLeading)
    var yheight : int := height
    var clr : array 1 .. xwidth, 1 .. yheight of int
    Font.Draw (word, 10, 300, font, colur)
    for x : 1 .. xwidth
        for y : 1 .. yheight
            clr (x, y) := whatdotcolor (x + 10, 300 + y - descent)
        end for
    end for
    drawfillbox (10, 298, 10 + xwidth, 300 + yheight, white)

    for y : 1 .. yheight
        for x : 1 .. xwidth
            drawdot (x + x_pos, y + y_pos, clr (x, y))
        end for
        delay (20)
    end for
end ThoughtEffect2
procedure ThoughtFadeIn (word : string, x_pos : int, y_pos : int, fontsize : int, colur : int, delay_time : int)
    var font : int := Font.New ("Comic Sans MS:" + intstr (fontsize))
    var xwidth : int := Font.Width (word, font)
    var height, ascent, descent, internalLeading : int
    var xrand, yrand : int
    Font.Sizes (font, height, ascent, descent, internalLeading)
    var yheight : int := height
    var clr : array 1 .. xwidth, 1 .. yheight of int
    Font.Draw (word, 10, 300, font, colur)
    for x : 1 .. xwidth
        for y : 1 .. yheight
            clr (x, y) := whatdotcolor (x + 10, 300 + y - descent)
        end for
    end for
    drawfillbox (10, 300 - descent, 10 + xwidth, 300 + yheight, white)
    for duration : 1 .. 2
        for l : 1 .. yheight
            for k : 1 .. xwidth
                randint (xrand, 1, xwidth)
                randint (yrand, 1, yheight)
                drawdot (xrand + x_pos, yrand + y_pos, clr (xrand, yrand))
            end for
            delay (delay_time)
        end for
    end for

    for y : 1 .. yheight div 2 + 1
        for x : 1 .. xwidth
            drawdot (x + x_pos, y + y_pos, clr (x, y))
            drawdot (x + x_pos, (yheight - y) + y_pos, clr (x, yheight - y))
        end for
        delay (20)
    end for
end ThoughtFadeIn
ThoughtEffect1 ("THOUGHTFUL's", 20, 30, 30, black, 10)
ThoughtEffect2 ("Effects", 400, 30, 40, blue, 10)
ThoughtFadeIn ("RULE!", maxx div 2 - 50, 100, 40, green, 20)
%effect(word : string, x_pos : int, y_pos : int, fontsize : int, colur : int, delay_time : int)

Author:  Tony [ Thu Oct 30, 2003 5:35 pm ]
Post subject: 

well I'm sure that dodge can tell you all about whatdotcolor Laughing

though you shouldn't be using it really.Got to be better ways out there.

Author:  thoughtful [ Thu Oct 30, 2003 7:02 pm ]
Post subject:  Rainbow Effect

Well, i made another effect using the same method , now i use window.open for the scratch pad. N E ways this actually look pretty okay.
PS:= Can any one tell me the command to get the RGB values of pixels.
code:

procedure ThoughtRainbow (word : string, x_pos : int, y_pos : int, fontsize : int, delay_time : int)
    var backgroundcolor : int := white
    var font : int := Font.New ("Ariel:" + intstr (fontsize))
    var xwidth : int := Font.Width (word, font)
    var height, ascent, descent, internalLeading : int
    Font.Sizes (font, height, ascent, descent, internalLeading)
    var yheight : int := height
    var clr : array 1 .. xwidth, 1 .. yheight of int
    var win : int := Window.Open ("graphics:" + intstr (xwidth) + ";" + intstr (yheight))
    Font.Draw (word, 0, -3 + descent, font, black)
    for x : 1 .. xwidth
        for y : 1 .. yheight
            clr (x, y) := whatdotcolor (x, y - descent)
        end for
    end for
    drawfillbox (10, 298, xwidth, yheight, backgroundcolor)
    Window.Close (win)
    for i : 1 .. 1
        for x : 1 .. (xwidth div 7) * i
            for y : 1 .. yheight
                if clr (x, y) not= backgroundcolor then
                    case i of
                        label 1 :
                            clr (x, y) := red
                        label 2 :
                            clr (x, y) := 42
                        label 3 :
                            clr (x, y) := yellow
                        label 4 :
                            clr (x, y) := green
                        label 5 :
                            clr (x, y) := 11
                        label 6 :
                            clr (x, y) := blue
                        label 7 :
                            clr (x, y) := 13
                    end case
                end if
            end for
        end for
    end for
    for i : 2 .. 7
        for x : round ((xwidth / 7) * (i - 1) - 1) .. round ((xwidth / 7) * i)
            for y : 1 .. yheight
                if clr (x, y) not= backgroundcolor then
                    case i of
                        label 1 :
                            clr (x, y) := red
                        label 2 :
                            clr (x, y) := 42
                        label 3 :
                            clr (x, y) := yellow
                        label 4 :
                            clr (x, y) := green
                        label 5 :
                            clr (x, y) := 11
                        label 6 :
                            clr (x, y) := blue
                        label 7 :
                            clr (x, y) := 13
                    end case
                end if
            end for
        end for
    end for

    for x : 1 .. xwidth
        for y : 1 .. yheight
            drawdot (x + x_pos, y + y_pos, clr (x, y))
        end for
        delay (20)
    end for
end ThoughtRainbow

ThoughtRainbow ("THOUGHTFUL", 50, 30, 40, 10)
ThoughtRainbow ("RockS!", 150, 200, 70, 10)

note:- If using a backround color other than white change the line
code:

var backgroundcolor : int := white

Author:  Tony [ Thu Oct 30, 2003 7:54 pm ]
Post subject: 

I think the rainbow effect would look better it was vertical instead of horizontal Confused

Author:  Catalyst [ Fri Oct 31, 2003 8:09 am ]
Post subject: 

another effect...

code:
setscreen ("graphics:480;150,nobuttonbar,position:300;300,offscreenonly")
type Bin :
    record
        c : char
        v ,g: int
    end record
var pixels : array 0 .. maxx, 0 .. maxy of int

proc GetPixels
    for i : 0 .. maxx
        for k : 0 .. maxy
            pixels (i, k) := whatdotcolor (i, k)
        end for
    end for
end GetPixels

var font : int := Font.New ("verdana:48:bold")
var fontS : int := Font.New ("verdana:6:bold")
cls
Font.Draw ("Catalyst", 10, 40, font, 1)

GetPixels

var cols : array 1 .. (maxx div 4), 1 .. (maxy div 6) of Bin
var cols2 : array 1 .. (maxx div 4), 1 .. (maxy div 6) of char
var hold : int
for i : 1 .. (maxx div 4)
    hold := Rand.Int (-3, -1)
    for k : 1 .. (maxy div 6)
        cols (i, k).c := chr (Rand.Int (48, 49))
        cols (i, k).v := hold
        cols (i, k).g := Rand.Int (28,30)
    end for
end for
loop

    for i : 1 .. (maxx div 4)
        for k : 1 .. (maxy div 6) - 1
            if pixels (i * 4, k * 6) = 1 then
                Font.Draw (cols (i, k).c, i * 6, k * 8, fontS, 42)
            else
                Font.Draw (cols (i, k).c, i * 6, k * 8, fontS,cols(i,k).g)
            end if
        end for
    end for

    for i : 1 .. (maxx div 4)
        for k : 1 .. (maxy div 6) - 1
            cols2 (i, k) := cols (i, k + 1).c
        end for
    end for

    for i : 1 .. (maxx div 4)
        for decreasing k : (maxy div 6) - 1 .. 1
            cols2 (i, maxy div 6 - 1) := chr (Rand.Int (48, 49))
            cols (i, k).c := cols2 (i, k)
        end for
    end for
    delay(10)
    View.Update
    drawfillbox (0, 0, maxx, maxy, 7)
end loop

Author:  AsianSensation [ Fri Oct 31, 2003 7:55 pm ]
Post subject: 

nice......

that is some cool stuff.....

Claping

though it looked cooler when you use 27 as the color to draw the word, then the word blends into the background, but you can still see it, because it's a bit darker than the background.

kudos

Author:  thoughtful [ Sat Nov 01, 2003 11:28 am ]
Post subject:  Another effect

Here is the vertical effect which infact does look better and another one i made.

PS:- Catalyst you are something man! ditch the school goto a uni!!! Razz
code:

procedure ThoughtRainbowVertical (word : string, x_pos : int, y_pos : int, fontsize : int, delay_time : int)
    var backgroundcolor : int := white
    var font : int := Font.New ("Ariel:" + intstr (fontsize))
    var xwidth : int := Font.Width (word, font)
    var height, ascent, descent, internalLeading : int
    Font.Sizes (font, height, ascent, descent, internalLeading)
    var yheight : int := height
    var clr : array 1 .. xwidth, 1 .. yheight of int
    var win : int := Window.Open ("graphics:" + intstr (xwidth) + ";" + intstr (yheight))
    Font.Draw (word, 0, -3 + descent, font, black)
    for x : 1 .. xwidth
        for y : 1 .. yheight
            clr (x, y) := whatdotcolor (x, y - descent)
        end for
    end for
    drawfillbox (10, 298, xwidth, yheight, backgroundcolor)
    Window.Close (win)
    for i : 1 .. 1

        for y : 1 .. (yheight div 7) * i
            for x : 1 .. xwidth
                if clr (x, y) not= backgroundcolor then
                    case i of
                        label 1 :
                            clr (x, y) := red
                        label 2 :
                            clr (x, y) := 42
                        label 3 :
                            clr (x, y) := yellow
                        label 4 :
                            clr (x, y) := green
                        label 5 :
                            clr (x, y) := 11
                        label 6 :
                            clr (x, y) := blue
                        label 7 :
                            clr (x, y) := 13
                    end case
                end if
            end for
        end for
    end for
    for i : 2 .. 7

        for y : round ((yheight / 7) * (i - 1) - 1) .. round ((yheight / 7) * i)
            for x : 1 .. xwidth
                if clr (x, y) not= backgroundcolor then
                    case i of
                        label 1 :
                            clr (x, y) := red
                        label 2 :
                            clr (x, y) := 42
                        label 3 :
                            clr (x, y) := yellow
                        label 4 :
                            clr (x, y) := green
                        label 5 :
                            clr (x, y) := 11
                        label 6 :
                            clr (x, y) := blue
                        label 7 :
                            clr (x, y) := 13
                    end case
                end if
            end for
        end for
    end for

    for x : 1 .. xwidth
        for y : 1 .. yheight
            drawdot (x + x_pos, y + y_pos, clr (x, y))
        end for
        delay (delay_time)
    end for
end ThoughtRainbowVertical
procedure ThoughtMosaic (word : string, x_pos : int, y_pos : int, fontsize : int, delay_time : int)
    var backgroundcolor : int := white
    var font : int := Font.New ("Ariel:" + intstr (fontsize))
    var xwidth : int := Font.Width (word, font)
    var height, ascent, descent, internalLeading : int
    Font.Sizes (font, height, ascent, descent, internalLeading)
    var yheight : int := height
    var clr : array 1 .. xwidth, 1 .. yheight of int
    var win : int := Window.Open ("graphics:" + intstr (xwidth) + ";" + intstr (yheight))
    Font.Draw (word, 0, -3 + descent, font, black)
    for x : 1 .. xwidth
        for y : 1 .. yheight
            clr (x, y) := whatdotcolor (x, y - descent)
        end for
    end for
    drawfillbox (10, 298, xwidth, yheight, backgroundcolor)
    Window.Close (win)
    for i : 1 .. 1
        for x : 1 .. (xwidth div 7) * i
            for y : 1 .. yheight
                if clr (x, y) not= backgroundcolor then
                    randint (clr (x, y), 32, 56)
                end if
            end for
        end for
    end for
    for i : 2 .. 7
        for x : round ((xwidth / 7) * (i - 1) - 1) .. round ((xwidth / 7) * i)
            for y : 1 .. yheight
                if clr (x, y) not= backgroundcolor then
                    randint (clr (x, y), 32, 56)
                end if
            end for
        end for
    end for

    for x : 1 .. xwidth
        for y : 1 .. yheight
            drawdot (x + x_pos, y + y_pos, clr (x, y))
        end for
        delay (delay_time)
    end for
end ThoughtMosaic


ThoughtMosaic ("THOUGHTFUL's", 50, 30, 40, 10)
ThoughtRainbowVertical("Effects",50,200,30,10)

Author:  Andy [ Sun Nov 02, 2003 3:16 pm ]
Post subject: 

tony wrote:
well I'm sure that dodge can tell you all about whatdotcolor Laughing


damn straight.... use what dot color or be Shoting

Author:  thoughtful [ Sun Nov 02, 2003 7:37 pm ]
Post subject: 

LOL, I think ill stick with what dot color Smile) Razz Razz Razz
By the way do you know a way to get RGB values of dots.

Author:  AsianSensation [ Sun Nov 02, 2003 8:23 pm ]
Post subject: 

first, use whatdotcolor (I am being total serious here, you actually have to use whatdotcolor)

then use RGB.GetColor

Author:  Catalyst [ Sun Nov 02, 2003 8:58 pm ]
Post subject: 

using the RGB functions can make whatdotcolor not function correctly, so beware

Author:  Tony [ Sun Nov 02, 2003 10:58 pm ]
Post subject: 

I'm sure it would... Since whatdotcolor returns an integer representing color on 255 pallet. RGB ofcourse has 255^3 colors, which is much much more Laughing

If you really need to, you can keep a vertual buffer in an array, so instead of drawing to screen, you draw to your buffer, which later draws to screen (just like View.Update works). The thing is - you'd have to rewrite all the Draw. module and you'll have major speed issues if your buffer gets too large.

Author:  santabruzer [ Sun Nov 16, 2003 8:59 pm ]
Post subject: 

Holy crap i should pay attention to computer science classes.... this stuff is amazing.. dudes... the font thingies....

Author:  Tony [ Sun Nov 16, 2003 9:11 pm ]
Post subject: 

yeah... well... you aren't going to learn any special effects in CS classes Confused This is all self-taught. Though you should pay attention to learn new syntax and understand how programing works, then you can imagine an effect you want to achieve and figure out a way of doing so.

Author:  santabruzer [ Mon Nov 17, 2003 4:53 pm ]
Post subject: 

I was told by the teacher i'm a self learner.. now how smart is the teacher? oh well.. i'm in the very first course... and i dunnu.. it's boring like hell.. problem solving... oh well...

Author:  Tony [ Mon Nov 17, 2003 6:28 pm ]
Post subject: 

exactly... thats why you got to find your own challange and figure out your way to achieve that. Variaous text effects are fun to play with Laughing

Author:  Tendulkar [ Tue Nov 25, 2003 10:24 pm ]
Post subject:  Re: [source code] Text Effects

tony wrote:
I've seen a lot of people trying to make RPG games in turing and some turned out quite nice actually. As Dan about QFTB, he has it posted somewhere.

Most of typical RPGs have plots (atleast they should) and chats with other NPCs. Basically you'll end up displaying a lot of text. In this post I will be posting source codes for different text effects that you can use throughout your games and other applications.




% HERE IS YOUR CODE:
var fullscreen := Window.Open ("fullscreen")
drawfillbox (0, 0, maxx, maxy, black)
var word : string
var x, c : int
colour (brightred)
colourback (black)
put "Enter The Word: " ..
colour (brightgreen)
get word : *
x := 50
var font : int := Font.New ("Lucida Handwriting:" + intstr (30))
var xwidth : int := Font.Width (word, font)
% THE NAME AT THE BOTTOM
process name2
loop
for i : 1 .. 250
Font.Draw (word, maxx div 2 - (Font.Width (word, font) div 2), 10, font, i)
delay (80)
end for
end loop
end name2
fork name2
% THE NAME IN THE MIDDLE
x := maxx div 2 - (Font.Width (word, font) div 2)
for i : 1 .. length (word)
if i = 7 then
c := 29
else
c := i
end if
Font.Draw (word (i), x, maxy div 2 - 10, font, c)
x := x + 30
delay (100)
end for

% THE NAME IN THE MIDDLE
process name
loop
x := maxx div 2 - (Font.Width (word, font) div 2)
for i : 1 .. length (word)
randint (c, 1, 35)
if c = 7 then
c := 45
else
end if
Font.Draw (word (i), x, maxy div 2 - 10, font, c)
x := x + 30
delay (50)
end for
end loop
end name
fork name


% THE TOP NAME WHICH IS MOVING
drawfillbox (0, 0, maxx, maxy, black)
loop
for i : 1 .. maxx + Font.Width (word, font) - 100
if i > 250 then
randint (c, 0, 15)
else
end if
Font.Draw (word, i, maxy - 50, font, c)
delay (15)
Font.Draw (word, i, maxy - 50, font, black)
end for
end loop

Author:  Tendulkar [ Tue Nov 25, 2003 11:31 pm ]
Post subject:  Re: [source code] Text Effects

HEY HERE IS THE CODE FOR TEXT EFFECTS::


Check this out

Author:  Tendulkar [ Tue Nov 25, 2003 11:32 pm ]
Post subject:  Re: [source code] Text Effects

Hey I also have one other program for text effects:


Check it out, too.

Author:  nis [ Wed Nov 26, 2003 11:48 pm ]
Post subject:  Glowing Text

Just a very very simple program i made

code:

setscreen ("offscreenonly,graphics:800;600,nobuttonbar")

var font1 : int := Font.New ("Comic Sans:200:Bold")
var x, y : int
x := 100
y := 200

drawfillbox (0, 0, maxx, maxy, 7)
loop
    for i : 19 .. 31
        Font.Draw ("N!$", 99, 200, font1, i)
        Font.Draw ("N!$", 100, 201, font1, i)
        Font.Draw ("N!$", 100, 200, font1, 7)
        View.Update
        delay (25)
    end for
    for decreasing i : 31 .. 19
        Font.Draw ("N!$", 99, 200, font1, i)
        Font.Draw ("N!$", 100, 201, font1, i)
        Font.Draw ("N!$", 100, 200, font1, 7)
        View.Update
        delay (25)
    end for
end loop


: