Another Bitmap Font Method?

Get help using Construct 2

Post » Mon Nov 05, 2012 2:42 am

Hey all, i'm looking another method to create bitmap font via events, it can relate to invisble text, if we type A, it could automatically creates a "bitmap font sprite" with start frame 1 as "A" sprite. The plugin and loop system wouldn't help for mobiles because it will won't work or performance problems.

Do you have an idea?

Thanks!


Joannesalfa2012-11-05 02:43:03
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Mon Nov 05, 2012 4:03 am

You could use a sprite with a frame per letter.
Then with events you could do a loop to read each letter eg mid(Text.Text, loopindex, 1).
Finally once you get a letter you can convert it to a frame number. ex find("abcdefghijklmnopqrstuvwxyz", letter).

Here is a example I did a while back:
http://www.scirra.com/forum/suggestionsprite-font_topic44315_post277605.html#277605
B
79
S
24
G
54
Posts: 4,754
Reputation: 40,771

Post » Mon Nov 05, 2012 6:23 am

[QUOTE=R0J0hound] You could use a sprite with a frame per letter.
Then with events you could do a loop to read each letter eg mid(Text.Text, loopindex, 1).
Finally once you get a letter you can convert it to a frame number. ex find("abcdefghijklmnopqrstuvwxyz", letter).

Here is a example I did a while back:
http://www.scirra.com/forum/suggestionsprite-font_topic44315_post277605.html#277605[/QUOTE]

Hello @R0J0hound, i already used your good example, but it uses loop which may cause performance issues for mobile, i'm looking another workaround which doesn't use loop. Do we have another workaround?
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Sat Nov 24, 2012 10:55 am

Isn't possible to make a list of alphabet without using loop?
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646

Post » Sat Nov 24, 2012 5:08 pm

A loop is unavoidable. You could unroll the loop and make more events to check each letter of the text but you would have to repeat the events the max number of letters you want to handle. The end result would be a bunch of repetitive events that are hard to maintain, only handle a maximum number of letter, and would likely end up performing the same.
B
79
S
24
G
54
Posts: 4,754
Reputation: 40,771

Post » Mon Nov 26, 2012 2:27 am

[QUOTE=R0J0hound] A loop is unavoidable. You could unroll the loop and make more events to check each letter of the text but you would have to repeat the events the max number of letters you want to handle. The end result would be a bunch of repetitive events that are hard to maintain, only handle a maximum number of letter, and would likely end up performing the same.[/QUOTE]

Oops, i believe you're right, anyways i see what i can do if switch group on/off while the spritefont is executing.
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,646


Return to How do I....?

Who is online

Users browsing this forum: Lof, YoHoho and 23 guests