Suggestion:Sprite Font

Discussion and feedback on Construct 2

Post » Sat Oct 06, 2012 12:30 am

I'm still unaware how to add new line
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Sat Oct 06, 2012 3:33 am

There still needs to be an official SpriteFont plugin. x)PixelPalette2012-10-06 03:34:33
B
50
S
11
G
7
Posts: 274
Reputation: 8,146

Post » Sat Oct 06, 2012 3:38 am

There 2 differences:

Manual implementation by ROJOHound can work on mobile devices, i tested CocoonJS, but still lacks the features.

Plugin Sprite font developed by Mipey offers the great features using new line, resize, etc. but it doesn't support for CocoonJS and appMobi.
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Sat Oct 06, 2012 3:58 am

[QUOTE=Joannesalfa] There 2 differences:

Manual implementation by ROJOHound can work on mobile devices, i tested CocoonJS, but still lacks the features.

Plugin Sprite font developed by Mipey offers the great features using new line, resize, etc. but it doesn't support for CocoonJS and appMobi.[/QUOTE]

I love Mipey's plugin though. Ash should take a look at it for reference, so games made with spritefonts can be uploaded to the arcade. 8)PixelPalette2012-10-06 03:59:08
B
50
S
11
G
7
Posts: 274
Reputation: 8,146

Post » Mon Apr 01, 2013 9:32 am

[QUOTE=R0J0hound] You can implement it with events. Whenever you change some text, set redraw to true.
http://dl.dropbox.com/u/5426011/c2/spritefont.capx[/QUOTE]
How can I use upper and lowercase with your code?

Thanks
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Mon Apr 01, 2013 11:38 pm

It's done the same way. The order of the animation frames should be like this:
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.,:;'""?!()"
or have what ever characters you wish to use. Then change the expression to not use lowercase():
find("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.,:;'""?!()", mid(Text.Text, loopindex, 1))
B
79
S
24
G
53
Posts: 4,732
Reputation: 40,227

Post » Tue Apr 02, 2013 2:21 pm

Rojo, could not get the code to work, I thought removing lowercase was the solution, but struggled with the code not working.

try for example:
abcdefghijklmnopqrstuvwxyzABC0123456789-.,:;'""?!()
didn't work

capx

I also tested adding only:
find("AabcdefghijklmnopqrstuvwxyzB0123456789-.,:;'""?!()", mid(Text.Text, loopindex, 1))

that should display uppercase A at index0 and uppercase B at index27, right?
see capx


any ideas why?
thanks
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Sun Apr 07, 2013 8:15 pm

Well it would appear that find() does case insensitive searching, so "a" is the same as "A". So we have to work around that. Dictionaries have case sensitive keys so we can use that.

First populate the dictionary with all the keys:
[code]
global string chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.,:;'""?!()"
start of layout
repeat len(chars) times
--- Dictionary: add key mid(chars,loopindex,1) with value loopindex[/code]
Then change the formula to:
Dictionary.Get(mid(Text.Text, loopindex, 1))
B
79
S
24
G
53
Posts: 4,732
Reputation: 40,227

Post » Mon Apr 08, 2013 7:05 am

Awesome R0j0!

I owe you a beer
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Mon Jul 20, 2015 9:21 pm

Hey Kyatric!

I opened your example and it looks like a good easy way to display own sprites as font.
I also tried to understand whats going on in the eventsheet but i can't.

1- Is it true that it replaces each character of a normal textobject by a single frame of the font u used?
2- If its true: how c2 knows what frame should be displayed with each character of the textobject?
3- I want to display the text of my dialogsystem. Could you give me a tip which of the events you used would be important for that?

kind regards,
spinat
B
3
Posts: 5
Reputation: 185

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 17 guests