GMS 2.3+ NEED HELP on the `visible` variable for my GUI event.

So I am trying to take advantage of the visible built-in variable and I need help with my approach.

The Draw GUI event is tied to the 4daf2a0e-d6b4-4160-b772-91814f4e7ea1.png object in the GIF.
When I set the Draw GUI event to what is seen in [ 1 ], the text box just stays there.
When set to what is seen in [ 2 ] & [ 3 ], the text and the box don't show up.



[ 1 ]
1622673270874.png

[ 2 ]
1622672665181.png

[ 3 ]
1622672618186.png

2021-06-02-15-12-07.gif

My objective is to make the text and the box show up when the player collides with the 4daf2a0e-d6b4-4160-b772-91814f4e7ea1.png object.

Am I in the right direction?

Any feedback is appreciated and will be swiftly be replied.
 

FrostyCat

Member
Setting visible to false skips all Draw-type events. This is why putting non-drawing logic in Draw-type events is a bad idea. Keep the tasks separate, and use the Step event for the collision check and the Draw GUI event for the box. It is more important to be correct than to be "efficient".
 
So how am I supposed to execute draw GUI events in a step event? I may need just some referral or quick instruction on how that works.
 
So how am I supposed to execute draw GUI events in a step event? I may need just some referral or quick instruction on how that works.
It's not that you're to execute Draw GUI events in anything but, it's that you have collision code which doesn't belong in that Draw GUI event. How is it supposed to be continually checked if you turn off the event, stopping the code from running?
 
Top