Quote: "My question however is this...
Say that the word is "Doooooooo"
Since we're using more than one "o", we can't just associate the asc() and image number with the sprite number and likewise for any other duplicated letter. So how do I use the entry$(1) command and duplicate a sprite while being able to return the correct sprite number when more than one letter ("Oooooooo") is used?
"
You can use different sprite numbers rather than the same sprite number for one letter... the only number that should be used in the ASC() command is the image number the sprite uses. Make the sprite letters a range of sprite numbers 1000 to 2000 (or more). Just do a check to see if the sprite already exists before creating a new sprite letter.
Quote: "BETTER YET (lol) - If I want the text centered how would I do that? Since were using sprites and I would need to know the first sprite's to position the next sprite's and then gather the width of both of them and divide by two...."
It's SCREEN WIDTH() divided by 2 minus the LEN() of the string times the IMAGE WIDTH() of one character divided by 2. Basically you start in the center of the screen and subtract the number of pixels from the center of the sprite string.
Same code above with sprites instead and centering:
` Load font
load bitmap "knight6.bmp",1
` Get images
for t=32 to 90
get image t,x,y,x+32,y+25,1
inc x,32
if x=320
x=0
inc y,25
endif
next t
set current bitmap 0
WriteText(0,0,"THIS IS A TEST",0)
WriteText(0,30,"GROG WAS HERE.",0)
WriteText(0,60,"HEEELLLOOOOOO!!!!!",1)
wait key
end
` Write the text using the bitmap font
function WriteText(x,y,Tex$,Center)
z=1000
` Calculate the center
if Center=1
x=(screen width()/2)-(len(Tex$)*image width(32)/2)
endif
` Go though each character in Tex$
for t=1 to len(Tex$)
` Get the ascii number of the current character
a=asc(mid$(Tex$,t))
` Find a new sprite number
repeat
inc z
until sprite exist(z)=0
` Create a sprite
sprite z,x,y,a
` Increase x so it doesn't overwrite the last character
inc x,32
next t
endfunction