Peter79 Posted February 16, 2018 Share Posted February 16, 2018 Hello, I'm trying to implement terraforming on an isometric tile map and I'm using multiple tilesets (with different offsets) to simulate elevation. Using this code when I click on a tile. tile.tileset = me.game.world.getChildByName("Terrain")[0].tilesets.tilesets[2]; However, I get "Uncaught TypeError: Cannot read property 'offset' of undefined" on melonjs.js:24629. It seems to be drawing the tile as the new tileset is being set. Is there a way to pause the drawing of tiles when I change the tileset or is there a better way to change the tileset for a tile? I'm using the MelonJS 5.1.0 with the boilerplate code on the latest version of Chrome for Mac. Many Thanks, Peter. Quote Link to comment Share on other sites More sharing options...
Peter79 Posted February 19, 2018 Author Share Posted February 19, 2018 Silly me. I forgot to set the tile.tileId to the correct value from the tileset. Quote Link to comment Share on other sites More sharing options...
obiot Posted February 20, 2018 Share Posted February 20, 2018 Hi, sorry fo the late feedback (Chinese holiday season in this part of the world) and yes indeed, the solution was to also update the "corresponding" tileId I do wonder though if manipulating directly those references/values is a good idea, and if we should not rather have something that better abstract the tile(set) "architecture" (e.g. if you change your tileset in Tiled, your index here above could then be incorrect?) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.