Hi. Does anyone know if it would be possible to load a tiled map with a variable connecting to a .json table?
I have transformed this script but I get an error with the directory:
game.lua
local filename = event.params.map or "scene/game/map/game.json" local mapData = json.decodeFile( system.pathForFile( filename, system.ResourceDirectory ) ) map = tiled.new( mapData, "scene/game/map" )
I try to call the filename of game.json to load sandbox3.json
game.json
{"filename":"scene/game/map/sandbox3.json"}
… what I try is that by colliding hero with an object on any screen, I save the screen, (for example, sandBox3.json) and then be able to restart the game on that screen by calling the filename table.
I would load it like this:
local json = require( "json" ) local loadsave = require("loadsave") local gameSettings = { filename = "scene/game/map/sandbox3.json", } loadsave.saveTable( gameSettings, "game.json" ) --but in this directory: scene/game/map/game.json"
Greetings, I hope you have explained me well