Im trying to find techniques for making tile based building more dynamic in my games. Most of my games end up having at least one tile based interface or game play so not having to define new tilemaps statically at construct time in each new game would be useful. My technique is to put data uris into an array for each bitmap ( the bitmaps have the tiles ), then run a create function for a map and provide an index in the array to use in the bitmap for the "Load from URL" action. The idea is that I reuse the functional code for creating the tilemap and then tell it what image data from the array to use for its skin/tileset.
The problem is that for all my tilemap instances, once I run the 'Load from url', it updates all instances with the new load. For example if I had 3 tilemaps and set some tiles into them, whatever I set the tiles to last with 'Load from url', all instances update; even if I create all kinds of convoluted ways to get the specific instance( using instance id, using global vars, using Self, using on Create, using uid, crazy pick all situations, etc. ). No matter what I do all instances update when I load any single instance.
Is there a way to do what Im trying or is the tilemap class meant to work as multiple instances of a tilemap all of whom share the same bitmap at any given tick?
Sorry if its a weird question, thanks for any insight.
Develop games in your browser. Powerful, performant & highly capable.
All instances of a given tilemap object share a single bitmap. No matter how hard you try, it is simply not possible. Sorry...