How do I read/write/edit a file (.txt)?

0 favourites
  • 5 posts
From the Asset Store
Convert multiple Excel files into JSON files and import them into construct3.
  • Hi,

    I did some research but didn't find or didn't understood the answers. And some were old answers with older plugin so I got confused a little bit.

    What I'd like to know is how (if we can) do we read/write/edit a text file (for examle).

    The idea is to make some kind of map generator (application1) that would store values in an array, and write it in a simple text file.

    Then in the "application2" (the game), we could load that map and play on it.

    Is there a simple way?

    Thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, it's a bit clearer now.

    But can we save the file within the project folder? more like just editing it or saving over it... instead of "downloading" the info.

  • Not really.

    If you want users to be able to store some level data etc on your servers, then you need to work with a database and for example send the data to it by calling a php script that does the data entry into the database.

    If you want to store it locally without any sharing between users, you can use the localstorage. In this case it would make sense to combine the map editor and game itself into one app, since then it would use the same local storage.

    If you want users to be able to share their creations you would need a database again, except if you are going for an inconvenient solution like users needing to copy and paste long strings of text into their game.

    At least that are the options that I see.

    Node Webkit has a file writing function, but it did not work for me, so meh... won't cover that here.

  • I see. Thanks for the explanation. I think I'll do with the download thing then. That editor is meant for me only to generate some inital maps for my game.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)