I’m using Tilesheet to draw my tilemap.
At first, there is no frame drop at all.
But when I move the scene (which makes to redraw the tiles) more than 30 seconds, the frame is dropped to 40(or less when I move longer).
My code looks like this:
public function update(elapsed:Float) {
tileData = [];
~~ //update tileData(concat array : tileData = tileData.concat([transform.position.x, transform.position.y, tile.type]);)
tilesheet.drawTiles(tileLayer.graphics, tileData);
}
Where is the wrong part? I don’t have any idea.
Ah, and one more question.
When I put tileLayer.graphics.clear() before drawTiles, whole screen goes white. why is that?
“which makes to redraw the tiles” normally you are always redrawing. You need to call clear, if you don’t the calls will stack. The tilesheet draw is not like the bitmap.draw it works more like graphics draw rectangle, the final draw won’t be cache. Graphics just calls each call each frame to create the final resul.
Yes you should call clear before drawing, but you also need to draw all the info again, recreate the entire array. Make sure that your array is not empty before you draw.
Well the size of the tiles are big, you are drawing 2,400,000 pixels thats more than double the resolution of 1280x720 = 1,048,576 pixels try using the bunny frome the BunnyMark as the texture. Whithout seeing your code, thats all I can asumme.