I'm doing a condition that check if an object overlaps another and the one with Y higher is set above to the other.
but right now this condition is consuming a lot of FPS when there's a lot of objects (testing with 100)
the condition is simple:
sprite1: is overlaping sprite1
sprite1:pick nearest to (450, layoutheight) ------- sprite 1:move to top layer
note: The ideal way is check only his y position but didn't found a condition like that so I added a random X value in the pick nearest event.
without the event the game runs with smooth fps(50+fps) with 100 objects, with the event on, it drops to 10fps.
Any idea how to optimize this event? the problem is probably checking every object overlaping another one..