Questions about loadEntities on tile layers (Ogmo Editor) and tileToSprite



  • I am a student transitioning from Unity to Haxeflixel. I am trying to load a tilemap from Ogmo Editor for a Sokoban game. The tiles will have a custom class derived from FlxSprite that has extended functionalities needed for the game. The problem is, I can’t find a way to convert them to custom sprites.

    I am aware of the loadEntities method from the FlxOgmoLoader class. From my point of understanding, this method gets all “entity markers” from the json level file and then calls a custom function that proceeds to add sprites based on the marker’s type. But this only works for entity layers, and my wall layer is a tile layer.

    I have found a method of the FlxTilemap class called tileToSprite on the Haxeflixel documentation, and it seems to fit with my requirements, but I just began with Haxe and I don’t understand much. One of its parameters is a FlxTileProperties object, but the documentation is sparse and didn’t help with my problem. I tried googling for tutorials and resources but found none.

    Unity has many resources online, so I’m not used to the lack of resources and documentation. Thus my last resort is to get help from the Haxeflixel community. If all else fails, I will make my walls as entities inside of Ogmo Editor, and then implement the loadEntities method, although this approach is not preferred since it would lead to conflicts in the code.

    To summarise, I am finding answers to the questions below:

    1. How does tileToSprite work, and will it solve my problem?
    2. If it doesn’t, is there any other approach to achieve what I need? (Besides making the walls entities)

    Help is appreciated. Please ask if any questions arise. I will be happy to answer.


Log in to reply
 

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