Maybe I’m just being stupid (highly likely) but I can’t find a solution to this for the life of me and wondered if a better man (or woman) could help me out.
I built an XML-powered platform flash game a while ago (parallax scrolling, pixel art graphics etc). then I built a level editor so that I could quickly compile new and wonderful levels. as part of the games programming, I had to do a number of hittests throughout (first in my logical code then translate this to the stage) - for all objects to see if my character was hitting say a wall, a baddy, an item, a spike, a slippery surface, etc etc.
Now when I built this game, I built it on my super iMac. It worked very well. Nice game. however when I put it on my site, I began to hear the cries… “this game is painfully slow”. What was happening?
I traced this to the processing power required to process all those hitTests. My for loop was continuously frame-independently checking if my character was coming into contact with every item in the level that had been loaded from my XML file on initialisation. That’s a lot of hitTests.
I’ve heard of hitTest zoning but can’t find anything on this, anywhere (maybe because it’s so simple… maybe not). Is there anyway to restrict this kind of check to items within a certain parameter from your character? anyone?