It's a long time since I posted anything useful. This is a tiny snippet of code that I have found very useful, along with the background on why you might use it.
I noticed that when Tweening text, it very quickly became jerky. In my scenario I had a table of 36 text objects, and each one has up to 10 characters. So it is a lot to ask of the tweening system. I'm guessing that each Text object has to be broken down into characters to be tweened, to account for the numerous things you can do at character level..
If the text is static and doesn't need to change, then converting it to a Sprite has many advantages in terms of handling. Immediately I have a much smoother experience, and there are many more transformations I can work with (e.g rotation, stretching etc).
The snippet below is very simple. Set up your text and then pass it into the function. It will return the Sprite ID. The sprite is moved off-screen.
Optionally you can delete the original text object.
function createTextSprite(id, delete)
ClearScreen()
SetTextPosition(id,1,1)
render()
ret = createsprite(GetImage(0,0,GetTextTotalWidth(id)+1, GetTextTotalHeight(id)+1))
SetSpritePositionByOffset(ret, -200,-200)
if delete = 1 then DeleteText(id)
endfunction ret
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt