Multiple Custom Fonts for Score

gizmokrisgizmokris Member, PRO Posts: 35

Hi all, Happy December! :o How did it get here?!

A quick question, Ive used the awesome tutorials suggested on here for creating a custom number font - works a treat! Until, I want to add another custom font for a different themed set of levels.
The problem occurs when I import the second set of 0-9 images, and I cant have them named "0.png" etc, because those names are already in use.

I attempted to alter the Constrain Attribute to show an extra character before the file extension ('i' in this example to relate to the 2nd themed world)
floor((tableCellValue( game.tblLevelAttributes ,1, game.Level )% self.div )/( self.div /10)).."i.png"
and I also then named the new set of numbers 0i.png, 1i.png, 2i.png etc.

I wasnt hopeful that the above would work, and the fact Ive made this post is evident that it didnt ;)

Any tips or advise as to if this is possible, somehow?
Please let me know if you need any extra info on how Ive programmed the rest...

Thanks, as always!

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Just add to the text extension so name the new font 1t.png so in the expression do "t.png" and you're all set.

  • BBEnkBBEnk Member Posts: 1,764

    Yea I've done the same thing but not using tables I just used "B.png" I see you did that not sure why it's not working for you. Unless it's a table issue.

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2014

    @gizmokris said:
    Hi all, Happy December! :o How did it get here?!

    A quick question, Ive used the awesome tutorials suggested on here for creating a custom number font - works a treat! Until, I want to add another custom font for a different themed set of levels.
    The problem occurs when I import the second set of 0-9 images, and I cant have them named "0.png" etc, because those names are already in use.

    Give them another name !

    Like Cheese_0.png or Font versionB 0.png . . . etc

    @gizmokris said:
    I attempted to alter the Constrain Attribute to show an extra character before the file extension ('i' in this example to relate to the 2nd themed world)
    floor(tableCellValue( game.tblLevelAttributes ,1, game.Level )% self.div )/( self.div /10).."i.png"
    and I also then named the new set of numbers 0i.png, 1i.png, 2i.png etc.

    I wasnt hopeful that the above would work, and the fact Ive made this post is evident that it didnt ;)

    . . . 'it didn't work' isn't very useful, saying what does happen is much more useful (the first number displays but never increments, no number displays at all, it displays the other font, it displays the extension and you don't want that, the image flickers rapidly between two values, it sticks after one cycle . . . etc.)

    (side note: you don't need the .png part)

    From what I can tell your code should work just fine.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    oh yeah that was the old method but do we need it now that GS supports other image types?

  • gizmokrisgizmokris Member, PRO Posts: 35

    @BBEnk‌ - Cool, well thats a good start, knowing that it can be done that way. :-D
    It just means that Ive not done something else correct somewhere along the way. (the joys of only have a few months experience in GS)
    The table is just used to pull in a 'goal' for the specific level, so it shouldn't have any affect on the font naming.

    @Socks‌ - Thanks, I'll try naming them with a different prefix if thats possible. I was under the impression that the name had to be exactly what the number was, nothing more. (On the side note - thats one thing I did know, I just put the file extension on for what seemed like better clarity ;) )

    I'll try the above first, and then explain in more detail if it 'doesn't work'

    Thanks chaps!

  • gizmokrisgizmokris Member, PRO Posts: 35

    @The_Gamesalad_Guru said:
    oh yeah that was the old method but do we need it now that GS supports other image types?

    So, I could save the second set of images as .jpg? Or have I completely misunderstood...

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    I can't remember what all the new imaging support is. I only use PNG and @RP does all our art.

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2014

    @gizmokris said:
    Socks‌ - Thanks, I'll try naming them with a different prefix if thats possible.

    I wasn't suggesting you need to rename your files (although you can of course do that) I was saying that you don't need to include the extension in the expression.

    Example, you have a numbered image sequence that runs . .

    Image_1.png . . . . Image_2.png . . . Image_3.png . . . Image_4.png . . . etc

    . . you can constrain it to the score like this:

    constrain image to "Image_"..game.score

    . . instead of this:

    constrain image to "Image_"..game.score..".png"

  • gizmokrisgizmokris Member, PRO Posts: 35

    @Socks‌ So, if renamed the new images to 'new_0', 'new_1' etc, how would I alter my expression? Like this:

    "new_"..((tableCellValue( game.tblLevelAttributes ,1, game.Level )% self.div )/( self.div /10))_

    If there is a tutorial you can recommend that might help me understand easier, please point me in the right direction

  • SocksSocks London, UK.Member Posts: 12,822

    @gizmokris said:
    Socks‌ So, if renamed the new images to 'new_0', 'new_1' etc, how would I alter my expression? Like this:

    "new_"..

    Yes ! "new_".. and then whatever you have controlling the number.

    @gizmokris said:
    If there is a tutorial you can recommend that might help me understand easier, please point me in the right direction

    I'm not aware of anything beyond the usual 'custom score font' videos on Youtube ?

  • gizmokrisgizmokris Member, PRO Posts: 35

    All sorted!! For some reason, the original way I tried ('i.png') works now.. this happened after GS crashed from a image import! (luckily I ALWAYS save now before importing an image due to that reason)

    Thanks for the other bits of advice, really appreciate it guys.... Im sure they will come in handy at some point :)

Sign In or Register to comment.