flashing label

I have an idea to make flashing label. When the player will be near some object (for example rock) there will appear flashing label (press "H" to hide or sth like this). I know how to do it if the label will be an object. But i don't want to make one more object for such thing. I wanted to make it in the events of the rock when it collides with the player. And i just wrote this:
GML:
draw_text(x, y, "press "H" to hide")
// x, y - rock coordinates
But nothing works. Does draw functions work only in draw events and i need to make one more object for this label or is there an easier way to achieve the goal?
 

TsukaYuriko

☄️
Forum Staff
Moderator
Does draw functions work only in draw events
They do work outside of Draw events, but anything you draw outside of Draw events will most likely be overwritten by the room background. So you may as well just pretend they don't work outside of Draw events to save yourself the headache of working around that.

GML:
draw_text(x, y, "press "H" to hide")
Escape quotation marks that you want to use in a string literal by prepending them with a backslash.

But i don't want to make one more object for such thing. I wanted to make it in the events of the rock when it collides with the player. And i just wrote this:
Then use the Draw event of whatever object you already have, but instead of trying to draw it in the Collision event, use the collision check as a condition to check whether the thing should be drawn, store it in a variable, then check that variable in the Draw event. You may want to use place_meeting in the Step event for the first part, as it mimics the Collision event while also giving you the option to do something with a "not colliding" result (unlike the Collision event, which doesn't have a "not colliding" variant).
 
They do work outside of Draw events, but anything you draw outside of Draw events will most likely be overwritten by the room background. So you may as well just pretend they don't work outside of Draw events to save yourself the headache of working around that.


Escape quotation marks that you want to use in a string literal by prepending them with a backslash.


Then use the Draw event of whatever object you already have, but instead of trying to draw it in the Collision event, use the collision check as a condition to check whether the thing should be drawn, store it in a variable, then check that variable in the Draw event. You may want to use place_meeting in the Step event for the first part, as it mimics the Collision event while also giving you the option to do something with a "not colliding" result (unlike the Collision event, which doesn't have a "not colliding" variant).
My rendered objects are moving along with the camera, how can I get rid of this ?

Myspaceship moved right and this thing (direction of the orange ship) moved with it
 

Attachments

TheouAegis

Member
Dont' use the Draw GUI event.

What's the code for your rendered objects and in what event did you put them?
 
Top