Windows Check Position for Draw Event

Discussion in 'Programming' started by Brackleforth, Mar 15, 2019.

  1. Brackleforth

    Brackleforth Member

    Joined:
    Jan 18, 2017
    Posts:
    23
    Hello,

    I am wondering if there is a way to check a coordinate for the draw event?

    I want to make an if statement that performs like this:
    if any object's draw event is drawing any sprite meeting with this coordinate, then perform the code between the curly braces.

    Is there any way to do this? I am familiar with position_meeting but that only checks for objects, not the draw event.

    Thanks!
     
  2. SoVes

    SoVes Member

    Joined:
    May 17, 2017
    Posts:
    108
    save the coordinates of the sprite you are drawing in the object and you can then use point_in_rectangle, position_meeting or what ever.
     
  3. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,280
    You will need to save the coordinates and the sprite's ID so you can find out what Sprite measurements to use in your calculations. If the number of sprites being drawn can vary, then I will just throw everything into a list for the easy clean up. You could store the Sprite ID, x it's drawn at, and why it's drawn it, and when you need to draw a new Sprite lookpthrough the list.

    Code:
    var i=0;
    while i<ds_list_length(sprites)
    {
       var spr = sprites[|i++];
       var sx = sprites[|i++];
       var sy = sprites[|i++];
       //check if the new sprite will overlap
    }
     

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