0 Favourites

Save into the imported project file

  • Hello fellas,

    I know there's a way to download array/string/dictionary data as a file, but what I'm looking for is the possibility to save into previously imported project file. Is it possible?

  • Hello fellas,

    I know there's a way to download array/string/dictionary data as a file, but what I'm looking for is the possibility to save into previously imported project file. Is it possible?

    if you export with NodeWebKit you have all action to make file an save to some folder in your computer...

    but if you are looking to export on web, you can't, you need to run a php code in your server and send data with AJAX, and save your file to some folder of your server... (php do this...)

  • Thanks, ist's basically the same as with mySQL posts.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks, ist's basically the same as with mySQL posts.

    you are welcome,

    yes, well, with the mySQL you can store a variable into a database, this is important to load all information of the player (username, password, email...coins, jems, levels...etc...etc)

    but when you need to save a big data text, like 200000 characters, you can't store on the database(you could...but is crazy)... I solved this with this step (on facebook app, but you can also make a login/registration page):

    -at the first access of the user, check if exist the UID of the user in database.

    • if doesn't exist, insert the UID with my data (username, password...coins "0", jems"0"...) on the database. (use method"POST") and you can also encrypt the data (there is a plugin on this forum)
    • make 2 folders in my server with the UID of the user. (PHP)

    this is just one file, if the user exist, just skip all of this, and if the UID exist, just load the database data.

    now, when the player open a level, I do this at the first access of every level:

    -at the first access of the level, check if there is a file json on a folder of the UID player with the name of the layout.

    -if exist, load a AJAX.string to an array. (this load everything about the level, coins taken, terrain, etc....)

    -when the player finish the level or find a save checkpoint, C2 will send a JSON string of the array with method POST on my php file, and when the php file has the data, just make a file with the name of the level in a folder of the user in .json.

    now, if the file doesn't exist, just load the orginal level...this works perfect for me.... (basically the array delete the coins taken, enemy, tilemap...or something like that)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
187 45,136
Yann's avatar
Yann
Unread hot topic
144 24,214
ffman22's avatar
ffman22
Unread hot topic Locked topic
112 7,118
Ashley's avatar
Ashley Construct Team Founder