Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Text Position Help!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mike200015




PostPosted: 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 ..
Sponsor
Sponsor
Sponsor
sponsor
person




PostPosted: Sun Feb 20, 2005 6:59 pm   Post subject: (No subject)

cant u just limit the name of the players?
mike200015




PostPosted: Sun Feb 20, 2005 7:03 pm   Post subject: (No 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
ssr




PostPosted: Sun Feb 20, 2005 9:19 pm   Post subject: (No subject)

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




PostPosted: Sun Feb 20, 2005 9:24 pm   Post subject: (No subject)

ohhhh font draw
anyway
u can still do that
add spaces
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: