How do I save a character unlocked?

Get help using Construct 2

Post » Tue Jan 06, 2015 4:17 am

@brunopalermo

I would like to ask if that greatmethod you used also works if the game is exported as exe (node webkit)?

@Fiammaoscura
nice game
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Tue Jan 06, 2015 10:33 am

Never exported using node webkit, but I believe it should work fine, @sgn15.

@Fiammaoscura I like the idea of writing a tutorial about this. I'll work on that. :)
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
20
S
6
G
2
Posts: 620
Reputation: 3,492

Post » Tue Jan 06, 2015 12:03 pm

I don't suggest to use webstorage for this kind of stuff...

I mean, if there is a shop in your game,for update something etc...and use coins or other things and the player just remove all cache (I remove the cache of the browser 5 time a week) he will lost everything.... also some software clean all cache of the browser for safe...

I suggest you to use a server to save a personal data for every user, it's easy and fast, and the savegame can be open in different computer...

also, if your game is for the nodewebkit, you can store in the computer (some folder...) If I remember :D
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Tue Jan 06, 2015 3:12 pm

@Ribis
How to save? I haven't tried that and no idea so far
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Tue Jan 06, 2015 7:16 pm

sgn15 wrote:@Ribis
How to save? I haven't tried that and no idea so far


You have to send a data with AJAX (like JSON string...variables...etc) and use php to save the file or send variable to your database...

In my game, I save all of the data on my server, every level has the json file in the folder of the user, to save the progress of every level, and I store the coin, life, update of the user....etc in a database

1° make a registration page (very easy, just let's make an user, pass and choose a random ID), if it's for facebook, you make a registration at the start with his UID, username, email...etc

2° Contruct2, will send a data (user,ID,password,email...etc) via AJAX to a php file, and the php file will insert the data on your database, and also, you can make a folder from the ID of the user in your server.

3°now, the problem it's when save the data... for the most of the game you don't have to think so much about this, for example, for the most game, you can use a checkpoint, a savegame button...etc... so, very easy, and you can store the savegame of the level in your server (think about a tilemap, if you destroy a terrain, collect some special item...)

4° now, in my game, I send a JSON string from the Array, and my php file will make a file in .JSON in a folder of the user with the name of the level.

5° at the start of the game, construct2 will load the variable of the database, and check if exsist any savegame for the level, if there is a savegame, just load the JSON file.

just simple script of php, you can find everything on the web and in a official manual of php ;)
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Fri Jan 09, 2015 9:23 pm

Well you're right but my game will run on Android, so no problem for mobile games ;)
B
17
S
3
Posts: 62
Reputation: 1,054

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests