I was wrong

Collision detection isn’t the bane of my existance. My redraw functions were. It seems that a “small fix” I had implemented last night is what was causing all of my problems. Instead of, as I had originally done, calling my DrawBuffer() and SwapBuffer() functions on each EnterFrame event for the root mc, I had changed it to only be called when a sprite or objects is added, updated or removed from my rendering array. Once I implemented the automated movement function, the image was being updated many, many times more than it should have been. Once I switched back to my original onEnterFrame handler, it runs much smoother with collision detection enabled.

I still need to work on the efficiency of the system, though. I can get about 20 rabbits on the scene before it starts slowing down. Without collision detection on, I can get around 200+ on the stage before I notice any sort of performance decrease. 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: