• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker right font doesn't show up

L

Lemon85

Guest
I'm trying to make a custom font with the font_add_sprite function, but every time I try to use the variable global.talkFont in other objects' events, it has an error and says it isn't defined. Also, the apostrophes don't show up.

For the Create Event, the code is:

map_string = "@\"?!.<>^~*:;,-#$AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz/[\\]%()1234567890[]&_=' ";

global.talkFont = font_add_sprite_ext(talkfont, map_string, true, 1);




For the Draw Event, the code is:

draw_set_font(global.talkFont)
draw_text(600, 600, "Please Work!");
 
Last edited by a moderator:

obscene

Member
So I've never done this so take my advice with a grain of salt...

Display the value of map_string to the screen and see if it looks like what you expect. I'm suspicious since it includes three double-quotes. Could be causing an issue.
 
So I've never done this so take my advice with a grain of salt...

Display the value of map_string to the screen and see if it looks like what you expect. I'm suspicious since it includes three double-quotes. Could be causing an issue.
He's terminating the double quotation mark in the middle with a backslash. That isn't an issue. I'm doing the exact same thing in my game right now and it works fine. In fact, I see absolutely nothing in this code that shouldn't work as intended.

What is the code the other object is using?
 

Yal

šŸ§ *penguin noises*
GMC Elder
If code changes don't work as expected, try cleaning your cache (the broom icon near the test play button). Sometimes cache files get corrupt so GM doesn't realize it needs to rebuild them after a change (and sometimes they get so corrupt you get weird visual glitches or other weird effects)
 
Top