GameMaker [SOLVED] Drawing to GUI is stacking?

Ok so I'm drawing the level on the screen.
On the first lvl it says "Level 1"... on the second it should say "Level 2".
It's working BUT the previous level is still there.
Like this:

Level 1: Skärmavbild 2020-05-20 kl. 19.43.53.png

Level 2: Skärmavbild 2020-05-20 kl. 19.44.04.png


Level 3: Skärmavbild 2020-05-20 kl. 19.44.16.png


... and so on. See my problem?

I have a persistant instance of an object called "oGame". There's a variable called level that increments by one every time I change rooms.
At the moment the code is in the Draw GUI End-event but I've moved it around a lot (with the same result).
It looks like this:
Code:
//Display current level

draw_text((RES_W - 100), 4, "Level " + string(level));
I'm quite sure I'm missing something really obvious and will be very ashamed after this.
In my defense... I've been away from GMS2 for a long time and I've never been good at it.
 
Are you using a surface for that particular part? There could be some issues about not clearing the surface if so. Otherwise, I would 100% make sure you only have 1 instance of oGame actually existing in-game. Use the debugger and check under the tab Instances to see what instances are running (or you could show_debug_message(instance_number(oGame)) but learning to use the debugger is a better option in the long term than constantly using debug messages).
 
I'm quite sure I'm missing something really obvious and will be very ashamed after this.
Are you using a surface for that particular part? There could be some issues about not clearing the surface if so. Otherwise, I would 100% make sure you only have 1 instance of oGame actually existing in-game. Use the debugger and check under the tab Instances to see what instances are running (or you could show_debug_message(instance_number(oGame)) but learning to use the debugger is a better option in the long term than constantly using debug messages).
Are you making it persistent and also placing it in all rooms?

Oh snap!
I was duplicating the rooms and then changing the content in them. So... yes... the oGame-instance followed.
I removed it and it's working now.
Thanks a lot for your quick replies (both of you were absolutely right.... and so was I... in terms of feeling ashamed now).
 
Top