Okay. Jacked from another thread:
Okay, so now I don’t understand what the hell is going on.
I figured the tileset was too big (since it was originally 480x480 and I wanted to scale it sixfold), so I went ahead and optimized the TMX file with a Tiled plugin. Basically you save the Tiled map in base64, run some magical python plugins, and it outputs two files.
Your original TMX file, but optimized (and still in base64), and a new tileset image. This tileset image only contains tiles that are actually being used by the TMX file.
So it’s basically a dream come true. Now, what I did was open the optimized file in Tiled, resaved it as XML (since I only know how to parse XML), and then we come to my game, which handles the scaling. Note that the new tileset image is only 96x96, and scaling it sixfold will make it “only” 576x576. I think that’s pretty damn good for an entire level.
So here we go, time to actually make it work with the game. F**k yeah! Oh wait, no! I still get the same “invalid” bitmapdata error. So is it even about memory? Is there some curse I have been carrying since birth? Is flashpunk disliking me as a user? What is going on here?
I will provide you with the entire source code of the gameworld (it handles the level loading), please take a look and see if you find any mistakes!
package game_handling { imports here
public class GameWorld extends World { [Embed(source="…/assets/circle_gradient2.png")] public static const SPR_LIGHT_CIRCLE_GRADIENT:Class;
vars here, and:
private var _map_Ground:Tilemap;
private var _map_BG2:Tilemap;
private var _map_BG1:Tilemap;
public var collisionData:Grid;
//Level1
[Embed(source="../../levels/ConvertBase64/output/Level_1/level_1_xml.tmx", mimeType="application/octet-stream")]private const LEVEL1:Class;
[Embed(source="../../levels/ConvertBase64/output/Level_1/Dungeon_1.png")]private const DUNGEON_1:Class;