Linc wrote: Ribis wrote:
I suggest to use AJAX and a database to store the variable, the best savegame system...hard to hack, and you can open the savegame with differente device
So, do I need to rent server space for this?
Also, how would saving and retrieving that data look like on an event sheet?
try to find some database free, I belive exsist some service who give to you a free database... but I'm not sure...
you need to use AJAX plugin, and of course you have to use php to save/update value in your database...
in event sheet looks like:
in the action of the event, select AJAX > Post to URL
"tag" = make some names for the tag, you can see if the AJAX finish to works, or has some error...
"URL" = url of the php file, for example, if your "example.php" (if is in the same folder of the game, index.html)
"Method" = POST.
"data" = this is the data that you want to send to a php file, so for example, if the player register an account in your game (at the start of the game) you have to send user,mail,password like this:
with this, you will send the 3 variables to a php file... and now, when you have the variable, you can make a script who send the data on the database... and to read these variables in php, insert this:
now, you have to know some PHP.... for example, to make works this perfect, you have to:
--make a function (in php) that check if an email or user exsist before the registration (and in the database select email/user unique)
> if exsist, echo an error like "user already registered", so, when the AJAX retrieve data in construct2, you can menage the situation.
--make sure the send data in a database (like mysqli_real_escape_string)
--when the php file register the user, if the user start with some coins or something else, just insert data in the database...etc
--in the LOGIN.php, check if the password insert is correct with the e-mail/username, if isn't correct, just retrieve a data as before for the registration.
>>if everything is working, load the data from the database from that user...
now, if you don't know how made it, you can find some tutorial/a full example how to make a php registration/login... contruct2 just send and retrieve data...
when you are sending data with the "Post to URL ", you can see what you retrive in the condition:
AJAX > On completed , and now, you can set a text with the AJAX.lastData, and see, if the php works well.
if you have more question just tell me