• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

Is it possible to check an collision for a draw event...

Perseus

Not Medusa
Forum Staff
Moderator
Collision with what exactly? There's functions like place_meeting() and position_meeting() which can be used for detecting collisions in whatever event you want to use. But to be able to give a more precise answer, we will need more details as to what you're trying to do. However, here's some sample code to get you started:
Code:
if (position_meeting(mouse_x, mouse_y, obj_Cheese)) {
    // Draw something...
}
 
If you're asking how to check for a collision with a string which has been drawn, then you'll want to look into 'string_width' and 'string_height', or if you plan on using 'draw_text_ext', there are also '_ext' versions of both. From there, you will probably want to use 'collision_rectangle' vs the instance you need to check collisions for, or 'point_in_rectangle' if you need a mouse click.
 
Top