Computer Science Canada

Using Font.New and the delay effect

Author:  Angel [ Sat Jan 03, 2004 2:38 pm ]
Post subject:  Using Font.New and the delay effect

I have a problem. I want to use Font.New but you can only do that with a Draw.Text command right? Well here's the code I want to use:

code:
var font1 := Font.New ("arial:12") % creates a new variable "font1" with the style: arial and the size: 12
colourback(13)
locate (7, 12)
Draw.Text ("W", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (9, 14)
delay (100)
Draw.Text ("E", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (11, 16)
delay (100)
Draw.Text ("L", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (13, 18)
delay (100)
Draw.Text ("C", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (15, 20)
delay (100)
Draw.Text ("O", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (17, 22)
delay (100)
Draw.Text ("M", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (19, 24)
delay (100)
Draw.Text ("E", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (21, 26)
delay (100)
Draw.Text (" ", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (23, 28)
delay (100)
Draw.Text ("T", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (25, 30)
delay (100)
Draw.Text ("O", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (27, 32)
delay (100)
Draw.Text (" ", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (29, 34)
delay (100)
Draw.Text ("M", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (31, 36)
delay (100)
Draw.Text ("O", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (33, 38)
delay (100)
Draw.Text ("V", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (35, 40)
delay (100)
Draw.Text ("I", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (37, 42)
delay (100)
Draw.Text ("E", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (39, 44)
delay (100)
Draw.Text (" ", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (41, 46)
delay (100)
Draw.Text ("T", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (43, 48)
delay (100)
Draw.Text ("R", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (45, 50)
delay (100)
Draw.Text ("I", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (47, 52)
delay (100)
Draw.Text ("V", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (49, 54)
delay (100)
Draw.Text ("I", maxx div 2, maxy div 2, font1, white)
colourback(13)
locate (51, 56)
delay (100)
Draw.Text ("A", maxx div 2, maxy div 2, font1, white)


I have no idea what maxx div 2 or maxy div 2 mean so when I run the program, the letters all show up in one spot on top of each other. I don't know how to fix it, and when the program gets to locate (27,32) it displays an error message saying Row of 27 is greater than maxrow (25). Anyone know how to fix it? Help!

Author:  AsianSensation [ Sat Jan 03, 2004 2:51 pm ]
Post subject: 

ok, the locate command does not work with Font.Draw command. locate works with text and whatnot.

the maxx div 2 and maxy div 2 are position of the left most bottom corner of the text drawn. Basicly, to change where the text are, you change those 2 numbers.

when you use locate, it finds the position by rows and columns, there are what, 25 rows and 80 columns in a standard turing run window (you can alter it if you want), so when you try to locate row 27, it's not there, therefore it gives you an error.

see the other post for the code to do what you wanted to do.

Author:  Angel [ Sat Jan 03, 2004 3:02 pm ]
Post subject: 

Ok, got it! Thanks. I posted another question in the other post. Sorry... I'm really new at this and need help!


: