Hello my dev fellows :)
I'm a newcomer to Flixel and Haxe, and I have followed the Dungeon Crawler tutorial from
this link. I'm in love with Flixel :D.
In the end of the tutorial, the author encourage us to try extending the game by adding more levels, more enemy types, and so forth. And I really like the idea, so I decided to write just a few lines of code, to try to add the functionality so when you finish a level, you can go to the next one.
In the FlxOgmoLoader related stuff, I made the following changes:
//Instead of
_map = new FlxOgmoLoader(AssetPaths.room_001__oel);
// I did
_map = new FlxOgmoLoader("assets/data/room-" + Std.string(_currentLevel) + ".oel");
// Where in this case room-1.oel is the name of the ogmo file and _currentLevel is a public static variable that is increased by one every time you finish a level successfully.
// In the game over class, the next map is loaded like this
if( FileSystem.exists("assets/data/room-" + Std.string(PlayState._currentLevel+1) + ".oel") ) {
_btnMainMenu = new FlxButton(0, FlxG.height - 32, "Next Level", goToNextLevel);
} else {
_btnMainMenu = new FlxButton(0, FlxG.height - 32, "Main Menu", goToMainMenu);
}
// Probably the worst way of handling this, but I just wanted some hacky fast way of doing this, just to make new levels with Ogmo and see what I'd get
*** Note *** : This method works perfectly if I build for windows.
The problems:
Flash: I can't use FileSystem.exists. -> What is a good way of doing this while in Flash?
Android: When I finish a level, and it's supposed to change to the next level, the app closes. -> Is that a problem related to the path to the assets folder?
I'd really appreciate any help!
and Hail Flixel!
* sorry for my bad grammar and poor vocabulary