• 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 Displaying Text on Multiple Screens

T

Torchbiz

Guest
Hello,
I am currently going through the tutorials of GMS 2 and I believe I've gotten through all the videos of the basic top-down shooter game. I wanted to complete it myself, and I'm having trouble with something. I have a gameover screen and I want to display the final score, but when I try to get the score using with(obj_score) and draw_text, it doesn't seem to work. I tried setting a final variable but that didn't work either. I created a new object to display the final score, is there any way I can grab the current score before the screen goes to the gameover so I can display it with draw_text?

Thank you
 
K

Kuro

Guest
What variable inside obj_score is keeping track of the score?

You could declaire a global variable and push the score to that before the gameover screen.
In your create event you could put something like:

Code:
global.final_score = undefined;
then in the game wherever you handle score where the game ends, just write:
Code:
global.final_score = obj_score.localscore;
With localscore being whatever variable you're using for score.
Then in your end of game screen you could put something like:
Code:
if(global.final_score != undefined) {
      //do things
}
 
Top