How do I use a spritefont more often?

Get help using Construct 2

Post » Fri Aug 26, 2016 9:46 am

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
Working on "EVERBLAST"
Image
B
31
S
6
Posts: 221
Reputation: 2,837

Post » Fri Aug 26, 2016 10:08 am

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.
B
55
S
24
G
13
Posts: 767
Reputation: 12,575

Post » Fri Aug 26, 2016 10:16 am

Thanks. It worked :D

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! :)
Working on "EVERBLAST"
Image
B
31
S
6
Posts: 221
Reputation: 2,837


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 34 guests