Ogmo Breaks FindPath?

  • I have noticed this thing and wondered if it has happened to anyone else. I am trying to build onto the MinimalTD example and add pixel tile maps to it using the Ogmo editor. I plug in my Ogmo map like usual:

            _map = new FlxOgmoLoader("tilemaps/GoblinRoad1.oel");		 
    	_mTreeTop = _map.loadTilemap("images/overworld.png", 16, 16, "TreeTop");			 
    	_mRoad = _map.loadTilemap("images/overworld.png", 16, 16, "Road");			 
    	_mBase = _map.loadTilemap("images/overworld.png", 16, 16, "Base");

    Then I leave the enemy path movement alone, with a few small changes:

    	var enemy:Enemy = enemyGroup.recycle(Enemy);
    	enemy.init(_enemySpawnPosition.x / 16, _enemySpawnPosition.y / 16);		
    	enemy.followPath(_mapB.findPath(_enemySpawnPosition, _goalPosition.copyTo().add(5, 5)), 20 + Reg.PS.wave);
    	_spawnCounter = 0;

    I change the name to avoid conflicts. I hit run. Everything is fine. I click to add a tower, it is added. Then the countdown to spawn an enemy begins, then when it finishes, it suddenly crashes.

    I am not sure what the problem is here. Almost nothing is changed except the inclusion of the Ogmo level and the switching of map variable name. (I have also changed the game's width, but that shouldn't affect anything?)

    The problem doesn't exist with the Ogmo levels removed.

    Anyone else experience this problem and or know how to fix it?

    I have attempted to use one of the other tile maps (Tree Tops, Road, and Base) instead of _mapB.findPath but those cause the crash as well.

  • Can you give more info on the crash, maybe a stack trace?

  • Check every object which fields and methods you access with dot for null value, for example, trace("Reg.PS: " + Reg.PS); trace("Reg.PS.wave: " + Reg.PS.wave);.

  • @IBwWG Honestly I can't really. That's all the information I have.

    @starry-abyss Again, good idea, but all the original code does not break and runs fine. It only crashes with the ogmo editor levels added in.

  • @xhunterko See crashdumper for how to get stack traces...

  • This is fixed. I have to give crashdumper that though.

    However, one more question. Does findPath handle "forks" in the road?

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.