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

Discussion in 'Programming' started by heanfry, Aug 30, 2017.

  1. heanfry

    heanfry Guest

    ...drawing a string ?
     
  2. Perseus

    Perseus Not Ragarnak Forum Staff Moderator

    Joined:
    Dec 29, 2016
    Posts:
    953
    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...
    }
     
  3. stainedofmind

    stainedofmind Member

    Joined:
    Jun 20, 2016
    Posts:
    701
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice