• 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!

Brand spanking new

A

Ajf1703

Guest
Hey all,

Just got GMS2 and while it's not my first time coding I'm pretty out of practice and will probably be on here a lot haha. I just completed the tutorial but wanted to add my own little flair to it: an end screen that tells you your final score and lets you replay the game by pressing enter. I managed to get most of it done by myself but I'm having trouble figuring out how to put the final score on the last screen. I've tried a few methods but most come back with an error or, at best, the last page comes up but the score is not displayed. Could someone help me or at least link a tutorial on how to do this? I'm really excited to start learning how this all works but I don't exactly know what to even search for so I'm hoping someone can help me out! Thank you :)
 

FrostyCat

Redemption Seeker
Assume that you have a font named fnt_final_score, an object named obj_final_score and the score in global.points. Then all you need to do is this in obj_final_score's Draw event:
Code:
draw_set_font(fnt_final_score);
draw_set_colour(c_black);
draw_text(x, y, "Your final score is: " + string(global.points));
Then put an instance of obj_final_score in the last room, done deal.

You need to redo that tutorial, because chances are there would be similar code elsewhere in it (e.g. HUD) and you're not paying enough attention.
 
Top