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

Global variables not working

V

Vallyrie

Guest
Hello,

I am trying to make a game where the player falls from the top of the screen, collecting letters along the way. I have a text set up in the corner where I'm trying to have a fraction display the amount of letters collected/left. I'm using the following code inside a spawner object's draw event:

global.letters = 0;
draw_text(735, (obj_player1.y - 370), "Letters = " + string(global.letters) + "/9" );


I have the following code inside the collision event of one of the letters (I'm using one letter to test):

global.letters ++;
instance_destroy(other);

The text is displaying, however the 0 is not increasing when I collect the test letter. Does anyone see what I'm doing wrong?

Thanks in advance everyone.
 
Top