How do I change a SpriteFont's image at runtime?

Get help using Construct 2

Post » Mon Oct 24, 2016 8:59 pm

Is this even possible with the vanilla C2 SpriteFont object? If not, is there a plugin available?

Thank you!
B
13
S
1
Posts: 10
Reputation: 502

Post » Mon Oct 24, 2016 10:35 pm

I don't believe so, you may need to use two different SpriteFont objects and switch between them.
B
54
S
24
G
18
Posts: 295
Reputation: 13,140

Post » Thu Oct 27, 2016 4:58 pm

Hmm, I wonder if this is something that could be modded relatively easily. We're planning on having a number of different pixel fonts and styles, and having so many SpriteFont objects would be less than ideal.
B
13
S
1
Posts: 10
Reputation: 502

Post » Thu Oct 27, 2016 5:41 pm

You could probably look inside the runtime.js of the sprite object and see how the "Load image from URL" is handled. Maybe it would be possible to replicate it inside a behavior to mod a SpriteFont object. It's important to inspect how the SpriteFont texture is managed too inside its own runtime.js, so you don't break anything with the behavior.
B
76
S
31
G
27
Posts: 1,015
Reputation: 20,790

Post » Wed Nov 02, 2016 10:26 pm

Silly question... where would I find the runtime.js for the Sprite and SpriteFont objects?
B
13
S
1
Posts: 10
Reputation: 502

Post » Thu Nov 03, 2016 5:43 am

In the installation folder, you'll find the "plugins" runtime and edittime js files under "exporters\html5\plugins\".
B
76
S
31
G
27
Posts: 1,015
Reputation: 20,790


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 30 guests