If you don't feel like creating another object every time you want to display a new line of text... (font image attached)
setVirtualResolution(640,480)
GLOBAL _Spr_FONT
_Spr_FONT = createSprite(loadImage("font.png"))
setSpriteAnimation(_Spr_FONT, 16, 18, 96)
setSpriteDepth(_Spr_FONT, 2)
do
drawText("This is a test.", getPointerX(), getPointerY(), 1, 1)
sync()
loop
function drawText(s$, x, y, boolCenterX, boolCenterY)
L = len(s$)
totalWidth = L*16
if boolCenterX = 1 then x = x - totalWidth/2
if boolCenterY = 1 then y = y - 9
for i = 1 to L
c = asc(mid(s$,i, 1)) - 31
setSpriteFrame(_Spr_FONT, c)
setSpritePosition(_Spr_FONT, x, y)
inc x, 16
drawSprite(_Spr_FONT)
next i
endfunction
In case anyone tried to download the font image and thought it was just a blank page, the font is there. It's white letters with a transparent background so it only appears empty.
"You're all wrong. You're all idiots." ~Fluffy Rabbit