0 Favourites

How do I use a spritefont more often?

  • Hey guys,

    how do I use a spritefont in different areas of the game instead of creating a spritefont for every text. I have a spritefont which is 2048x2048px. That means every spritefont object has about 30mb memory cunsumption.

    How can I use one spritefont for different variables I want to show. Right now I have 10 seperate objects for every text (which ends up in 300mb memory cunsumption)

    Is there any way? Can you also use different behaviours on one spritefont?

    Thanks and regards

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Why are the spritefonts so big? Isn't it better to have a spritefont image that only is as big as the biggest text in your game? My game has about 3 different spritefonts: small, medium, large which I use throughout the whole game for tons of different purposes. By doing this I can choose the best sized spritefont so I can avoid scaling it too much.

    And you can set instance variables on the text objects or use UIDs.

    Example:

    On collision with coin ---> spritefont - set text to score

    --------------------------------------isSCORE

    On death ---> spritefont - set text to deathcounter

    -------------------- isDEATH

    And so on...

    This way you can use the same spritefont object for alot of different things.

    And yes you can use many behaviours on the same spritefont.

  • Thanks. It worked

    The size came from a template I bought. Don't know how to resize it to about 20% of the size.

    But thanks for the quick help!

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