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

How to write a text over an objet ?

E

Erik131313

Guest
Hi,

To program in GMS2, I use a non visible objet in the room. I use after the parts : create, steps and draw.

If I write in the draw part : draw_text(100,100, "Hello") . Hello is written on the screen.
After, if I write in the step part :
global.Layer[0] = layer_create(0);
a = instance_create_layer(100,100,global.Layer[0],olosange);

Hello is over the objet olosange. It is that I want.

But if I move an other objet at the position 100,100, Hello disappear. Perhaps is he under the other sprite ?
In which layer is written the text Hello ?
How do I do to have always the text over all the objets ?

Thanks.
 
Unless you have your layers arranged in an array (which I've never seen, but this is not crazy at all, honestly), you should pass the array ID, or it's name as a string.
What's exactly is in your global array? Strings?

EDIT, I see it now, try layer_create(-9999, "layer"); and a = instance_create_layer(100,100,"layer",olosange);
 
E

Erik131313

Guest
Thanks.
When I clic on the rectangle or losange on the screen, my program allows to create new rectangles and losanges. After, I can move them with the mouse where I want on the screen.
At the begin, a number is draw on the left corner of the screen (picture1). When I move a form on the number, it disappears (picture3).
I want that the number stay over the objet.
 

Attachments

P

ParodyKnaveBob

Guest
Howdy, Erik3333333333333, $:^ }

There are bunches of ways to go about this. One way is to get your number-displaying instance onto a layer with lower depth; another is to change the object or instance to have a lower depth. Possibly friendlier to what you're trying to do, you can also have your number-displaying object draw the number in the Draw GUI Event (or perhaps the Draw End Event). Explore your possibilities!

I hope this helps,
 
Top