Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Text Sprite snippet

Author
Message
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Sep 2017 10:49
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.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Sep 2017 15:54
Nice!
A simple but useful function.
I wasn't aware of the tweening issue with text (although it makes sense when you think about it) but now I'm aware of it and I have a solution for it.

Thanks

Login to post a reply

Server time is: 2024-11-24 07:38:41
Your offset time is: 2024-11-24 07:38:41