tags:

views:

15

answers:

0

Hey everyone, I'm coding a small strategy game in Flex, now the game has the main map component and the minimap component - now when the main map is moved, the minimap's rectangle (that shows what you're currently looking at) moves with it.

Now I use a very simple, apparently not memory/cpu heavy calculation to check the current location of the rectangle scaled to the minimap, however, whenever this calculation is called - my computer is slowed down heavily - and if called whenever the map is moved, slows down the map rendering by up to 50%!

Here's the formula I'm using to calculate the X/Y of the rectangle compared to the main

rectangle.x = offsetX * miniMapWidth / map.totalMapWidth;
rectangle.y = offsetY * miniMapHeight / map.totalMapHeight;

Now this seems like a simple task for Flex to calculate, so how come it slows down everything so badly, and what can I do about it???

Thanks!