Sign in to follow this  

Changing tileset for a tile

Recommended Posts


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 ="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,


Share this post

Link to post
Share on other sites

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?)


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.