GMS 2 DND Drawing GUI after If/Else statement

Astabeth

Member
Hi!

I am using GameMaker Studio 2 DnD and I am trying to get a popup saying "You Win" upon collision with a goal object if there are no instances of pickups left in the room. I used to use GameMaker for Mac, and I would use the Check Question button:

If there are pickups left
Jump to start
Else
Check Question "You win! Do you want to play again?"

and if they clicked yes, restart game, if no, end game

Well, I can't find anything like that in the GameMaker Studio 2 DND interface, so I was just going to have it draw the words "You Win"

If there are pickups left
Jump to start
Else
Draw text "You Win" or whatever I need to do here.
I found the Draw Value button, but it doesn't work - I think I need the Draw GUI event, but I don't know how to add an event to an event - can anyone help?

Thank you so much!
 
Last edited:
So I'm assuming that this is running in the Step Event right? You can't "add an event to an event", but you can change a variable in one event and then do something in another event based off that variable. For instance, you could set a variable in the Create Event to false:
Code:
game_finished = false;
And then in your Step Event, you can do your if check:
Code:
if (there are pickups left) then
   jump to start
else
   game_finished = true
This time setting the game_finished variable to true, instead of trying to draw something (which you always have to do in a Draw Event). Then finally, in the Draw Event itself, you would check the value of game_finished and draw the text only if it is equal to true:
Code:
if (game_finished) then
   draw_text(x,y,"You win!");
 
Top