Computer Science Canada

Text Position Help!!

Author:  mike200015 [ Sun Feb 20, 2005 5:43 pm ]
Post subject:  Text Position Help!!

in a program i made, there are 2 players that enter their name, which appear at the top of the screen at the right and left corner. Beside the name it shows their score, but how would i make it so that the score will go about 3 spaces after their name depending on the length of the name.

Also on the right side (player 1 name), if the name is 2 long then it goes off the screen.. heres the code for it:

code:

var p1name,p2name :string
var length1,length2,score,score2 :int
score:=0
score2:=0
var font3 :=Font.New ("Arial:10")

Font.Draw ("Player 1, please enter your name: ", 3, 373, font3, blue)
locate (2, 36)                     %Player1 name input location
colour (blue)                     %Player1 name input colour
get p1name : *
length2 := length (p1name)
cls
Font.Draw ("Player 2, please enter your name: ", 3, 373, font3, blue)
locate (2, 36)                     %Player2 name input location
colour (blue)                     %Player2 name input colour
get p2name : *
length1 := length (p2name)
cls

colourback (0)                         %background
cls
Font.Draw (p2name, 2, maxy - 12, font3, blue)
locate (1, length1 + 2)                            %score2 number location
colour (blue)                             %score2 remaining number colour
put score2 ..
Font.Draw (p1name, maxx - 80, maxy - 12, font3, blue)
locate (1, maxcol - 3)                             %score number location
colour (blue)                             %score number colour
put score ..

Author:  person [ Sun Feb 20, 2005 6:59 pm ]
Post subject: 

cant u just limit the name of the players?

Author:  mike200015 [ Sun Feb 20, 2005 7:03 pm ]
Post subject: 

i guess i could, but still if i do that then if they enter just like 2 letters or something, or a longer name i still want the space between the end of the name and the score to always be the same

Author:  ssr [ Sun Feb 20, 2005 9:19 pm ]
Post subject: 

lol why not just do somethign like this
code:
var name :string
get name:*
put name,"   "..
put name
Laughing Laughing

Author:  ssr [ Sun Feb 20, 2005 9:24 pm ]
Post subject: 

ohhhh font draw
anyway
u can still do that
add spaces


: