Hello,
I have a JSON file(type Dictionary) in Project files.
The JSON will contain all levels that user designed.
How do I write into JSON file in runtime?
Like I press a button, the level will be insert next Key in JSON.
Thanks!
You can't overwrite project files in runtime. If you make changes to JSON, you can save it to Local Storage. When game starts, first check if there is updated data in Local Storage, if not - load the default data from the file.
Develop games in your browser. Powerful, performant & highly capable.
Project files won't work, but external files could.
Ajax can post and get files from web sources and nwjs can do so for local files.
Thanks guys :D
Ajax can post and get files from web sources
Can you write to files directly with AJAX? I thought this is only possible if you send data to a PHP script, which will write it to a file.
Err yes as dop said, ajax post to php, which can write directly or interface with a database on a web server.