1. Hey! Guest! The 33rd GMC Jam will take place between May 23rd, 12:00 UTC (Friday noon) and May 27th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Windows Check Position for Draw Event

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

  1. Brackleforth

    Brackleforth Member

    Jan 18, 2017

    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.

  2. SoVes

    SoVes Member

    May 17, 2017
    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

    Jul 3, 2016
    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.

    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