Windows Check Position for Draw Event

B

Brackleforth

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

SoVes

Member
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!
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.
 

TheouAegis

Member
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
}
 
Top