View Single Post
Old 06 March 2018, 13:34   #20
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,369
Wow... I knew the Zones were slow, but that's very slow! I can only guess that it's doing some sort of full mathematical analysis of the zone, instead of taking easy shortcuts. RectsHit is a good alternative, and an even simpler version just for a single pixel might avoid some overheads within RectsHit for dealing with two rectangles:

Code:
If x >= zonex1
  If x <= zonex2
    If y >= zoney1
      If y <= zoney2
        collision = True
      End If
    End If
  End If
End If
Longer code but might be quicker than RectsHit (though I haven't tested it). It could be put in a macro for speed and neatness, and the x and y checks could be swapped if the zone is very tall and narrow for more improved speed, as it's less likely to have to check all sides.
Daedalus is offline  
 
Page generated in 0.07224 seconds with 11 queries