Suggestion:Sprite Font

  • 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))

  • 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

  • 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:

    global string chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.,:;'""?!()"
    start of layout
    repeat len(chars) times
    --- Dictionary: add key mid(chars,loopindex,1) with value loopindex

    Then change the formula to:

    Dictionary.Get(mid(Text.Text, loopindex, 1))

  • <img src="smileys/smiley20.gif" border="0" align="middle" /> Awesome R0j0!

    I owe you a beer <img src="smileys/smiley41.gif" border="0" align="middle" />

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

    Construct2 now has an official spritefont plugin..

  • Hey LittleStain

    Thanks for your quick answer!

    I checked out the sprite font plugin, spritefront + and Give Your Fonts Mono.

    I also checked the tutorials on this, but its a way to complicated to me.

    I'm working on an easy solution to view my own textsprites.

    Would you take a look at the following picture and tell me if it's realizable?

    I created text instance variables for my dialogobject and have a single sprite with about 50 frames in it (letters, points...).

    This works, but my problem is that it shows just "C" if i set the dialog object to ABC.

    I guess c2 jumps immediately from one event to the next one. Do you know how to

    show all letters at once?

    kind regards,

    spinat

  • Can you share a .capx file?

    Tag me using Iolva or send me PM

  • If setting a spritefont is complicated for you (which is probably a lot easier than setting a multi frame/animation sprite object), then recreating it with events will be even more complicated for you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)