update------------
Thanks for the help guys - I rewrote it by blitting to a background bitmap that I move around as a whole, redrawing an edge and snapping the background background bitmap back back by a big blit as necessary.
You can see it here:
http://web.mit.edu/span/Public/Flash5.html
Crude, I know, but can be improved.
Thanks!
Also, beware of blitting in place. I copied a section of a bitmap onto another section of itself. Flash doesn’t do it carefully - there’s no guarantee that flash won’t write to a section of the bitmap that it still needs to copy. That led to a lot of confusion for me.
Hey,
I’m trying to make a graphical representation terrain using a heightmap. So all areas of the heightmap less than 20 should be drawn as water, between 20 and 30 is beach, etc.
I have a (slow) implementation of this. Whenever the camera moves and there would be blank space on screen, I attach new tiles to one of my layers. I’ve got tiles for each terrain type, and upon creation of the tile, I just sample the heightmap to see which type of tile it should be.
Unfortunately this is very inefficient. I’ve got roughly 150 movieclips, all of which need to update their position every frame based on where the camera is. They do destroy themselves when they go offscreen. This burns around 20-30% of my cpu when run locally, obviously not OK for the background of a game.
Anyone have an idea for a way to do this more efficiently?
Thanks.