Search code examples
2dhaxe2d-gameslevelshaxeflixel

HaxeFlixel & OGMO Editor - Some tiles are blank


I am using the OGMO Level Editor to create 2D levels for my game, and then loading them into my game using the FlxOgmoLoader flixel addon. I am saving the levels in CSV format in OGMO.

In the game, some tiles (usually about 3-4 per level) appear as black. If I open the level in the editor, the tiles will appear how they are supposed to.

In the OEL file for the levels, these blank tiles are represented by 0. If I change the number by hand then they will appear as they are supposed to in the game.

Because OGMO can open the levels and display them just fine, I am assuming this is a problem with the way HaxeFlixel is loading them in, and not with the way OGMO is saving them.

Also, the tileset I am using is 3 tiles wide and 7 tiles tall, and each tile is 32x32 pixels.

Here is how I am loading the levels:

// The class I am using to load the levels
import flixel.addons.editors.ogmo.FlxOgmoLoader;

// In my PlayState class
private var _map:FlxOgmoLoader;
private var _mWalls:FlxTilemap;

// In the create method of my PlayState
_map = new FlxOgmoLoader(AssetPaths.Dungeon_Room_1__oel);
_mWalls = _map.loadTilemap(AssetPaths.Simple_Dungeon_Tiles__png, 32, 32, "walls");
_mWalls.setTileProperties(7, FlxObject.NONE);

add(_mWalls);

super.create();

Why is this happening, and how can I fix it?


Solution

  • FlxOgmoLoader requires the tile with index of 0 to be blank and will never be drawn.