Hey Dyson - quick question.
It’s my own fault for not sticking up to date with the latest updates, and then struggling when I decided to update (damn those sexy new features :0) )
You may or may not remember that I was needing to store properties on each individual tile/cell in my map; you suggested creating my own two dimensional array containing the data and then attaching this to the map table from getMap() - http://forums.coronalabs.com/topic/41163-add-ability-to-mark-tiles-or-layers-as-property-only/
I then json’ed this, saved it to file and loaded it as needed.
This worked flawlessly until I updated to v980, which is now complaining when I try to json.encode the table about function variables contained within the object.
Upon closer inspection it seems as though the table returned from getMap() now contains a 2D array named tileObjects, which seems to contain entries that have a field containing a function named makeSprite() and also seem to hold references to the display objects ?!?
Obviously I could strip these away, but that’s going to get messy. So I was just wandering whether you could suggest a better approach.
My workings were before you implemented saveMap into MTE - so I was manually saving the data and loading. Presumably MTE’s inbuilt functions will save me this hassle but I need to consider the workflow.
Just to recap my map contains 5 layers - (from bottom to the top), the first three layers represent Water, Dirt and Grass. On top of this is the Sprites and Objects layer, followed by a layer that contains white tiles that I adjust the colour accordingly to represent a “heatmap” of the aforementioned tile/cell properties. The layers are really there for a visual effect, i.e you dig through one layer to reveal the one below.
I truly believe I’m making things more complicated then they need to be - and the fact that my setup isn’t working on the updated MTE has encouraged me to refactor my solution.
Presumably my old technique of attaching my cell properties to the table returned by getMap() is not going to work unless I parse the table and strip away the entries that hold functions, display objects, etc… - NOT A GOOD SOLUTION.
So my question, in a really long-winded way is can you suggest a better approach to having properties stored on each individual cell, and the way to go about saving this so the game state is re-loaded when the player picks up the game again?
Many thanks…