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

GML I might see my collisions, lines, invisible things.

GGJuanPabon

Member
Hello friends how are you? First sorry for my English is not my native language, if someone expresses himself in Spanish, better for me.

What I want to know is ... how do I see some invisible things like ...

collision_line
collision_circle
distance_to_object
collision Mask from player
collision mask from enemy.
ETC

Sometimes I would like to debug or optimize the game, but it is impossible for me to do it blindly, I mean, I would like to go debugging, developing or optimizing the game, seeing those layers and others ... which are obviously invisible.

I have seen many forums that indicate things like:
bbox_
draw_line_width
draw_arrow
draw_circle
draw_circle_colour
draw_line
draw_line_colour
draw_line_width
draw_line_width_colour
draw_point
draw_point_colour
draw_rectangle
draw_rectangle_colour

But when I try them, I can't see it in the game window. I do not know what I do badly. But I can't see anything I want to see.

Many, but thank you very much for the help.
 
If you have a collision_line() command in an object:

Step Event:
Code:
collision_line(x1, y1, x2, y2, o_enemy, true, true);
Then to do the debug draw you would do:

DRAW Event:
Code:
draw_line(x1, y1, x2, y2);
Important : Are you placing your draw_line() function in the Draw Event?

Also, for this to work, the variables x1, y1, x2, y2 will need to be instance variables. That is, you should declare them in your Create Event:

CREATE Event:
Code:
x1 = 0;
y1 = 0;
x2 = 0;
y2 = 0;
Don't use the "var" keyword to declare them, otherwise they will only exist in the event that you are using them in, and you won't be able to use them in the Draw Event.
 

GGJuanPabon

Member
Important : Are you placing your draw_line() function in the Draw Event?
Now everything makes sense in my life, and I reappear in the most stupid thing that human beings can become due to lack of knowledge. o_Oo_Oo_Oo_O

:confused: I thought the event (Draw) was for hand drawing games ... I think I'm going to place the game maker in English. Because in Spanish the event is called verbatim (Dibujar) the translation of Draw. 2 different names, I couldn't find a relationship.

Therefore all the Draw, placed them in the event Step of the player ...:oops: Plop.

@IndianaBones Thank you very much for teaching me friend, I guess now I can try the Draw that I had tried before.

Edit @IndianaBones ok, it worked for me, I see that now I can draw the line, but, this replaces my sprite. Is there any way to preserve the sprite and the line at the time?
 
Last edited:

Neptune

Member
Hey man, if you do NOT have a draw event in your object, and the object is visible - then it is automatically running the function 'draw_self()'.
If you add a draw event, you have to remember to add
Code:
draw_self();
draw_self() uses the built in variables
Code:
sprite_index
image_index
x
y
image_xscale
image_yscale
image_angle
Alternatively (and for the better) try
Code:
draw_sprite(spr,img,x,y);
draw_sprite_ext();
 
I thought the event (Draw) was for hand drawing games ... I think I'm going to place the game maker in English. Because in Spanish the event is called verbatim (Dibujar) the translation of Draw. 2 different names, I couldn't find a relationship.
That is interesting! :) Sorry to hear the translation caused some problems.

I'm happy its working for you now.
 
Top