dhezyr Posted August 1, 2018 Share Posted August 1, 2018 Hi everyone, This is my first post in here but I generally read most of the topics in this forum. I couldn't find anything about this topic. So this is the question; I'm trying to generate a random world with a tile map in phaser. I want to extend Tile class to use in my needs for example; clicking a tile or when you hovering mouse on a tile it will give the information depending on the tile type. So I want to get those infos from extended class itself. Addtionally when you click on a tile maybe you I will trigger some actions and every different extended tile class has its own implementation for onclick function (you know the idea here...). But when I do this and using the putTileAt() function, in the layer data I still see the tile object type as Phaser.Tilemaps.Tile, because in the source code it's just copying the attributes of the extended Tile class to Phaser Tile class. This is done on purpose I believe but I want to use some polymorphism in my code and don't want to write custom code (by puting the extended tile object to its cordinatte with layer.data[j] = new XTile()) for this because I want to be depended on phaser 3 framework with tilemaps. How I can achieve this? Thanks in advance for your opinions Bests Deniz Link to comment Share on other sites More sharing options...
dhezyr Posted August 3, 2018 Author Share Posted August 3, 2018 Any opinions? If its not clear I can explain a little bit in detail. Or if you can propose another approach it is also fine I have also some in my mind but this is the way I want to use. Bests Link to comment Share on other sites More sharing options...
samme Posted August 3, 2018 Share Posted August 3, 2018 You would have to override the Tilemap methods to create your custom Tile class. It might be easier to modify the Tile class itself. Link to comment Share on other sites More sharing options...
Recommended Posts