Save which level you are.

Get help using Construct 2

Post » Sun Jun 17, 2012 2:47 pm

Hello,

I have a question:

I make a game with Construct 2, and they are now 3 levels, (there coming more). I want to make a save system. If you play the game the first time, you can only play level 1. If you have level 1 done, you go automatic to level 2. But if you stop, i want that you can save the game. If you come back later, you can play where you are stopped. I make the game for HTML 5, and maybe later for android.

Know some one how i can do that?

Thanks.

(Sorry for my bad English. I am not an Englishman...jelmer112012-06-17 14:49:04
B
6
Posts: 17
Reputation: 448

Post » Sun Jun 17, 2012 8:54 pm

You should read about AJAX and WebStorage in the manual.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Jun 17, 2012 10:36 pm

This example uses WebStorage.

Local storage is permanent until the user clears their cache. If the player plays the next day, local storage has the saved data.


https://dl.dropbox.com/u/12633239/level-webstorage.capx
B
17
S
3
G
1
Posts: 28
Reputation: 1,763

Post » Mon Jun 18, 2012 1:56 pm

[QUOTE=andorade] This example uses WebStorage.

Local storage is permanent until the user clears their cache. If the player plays the next day, local storage has the saved data.


https://dl.dropbox.com/u/12633239/level-webstorage.capx[/QUOTE]

Thanks, this is what I search. I am trying to put this in my game.

Edit: If I make my game for android (apk) with phonegap. Does this than also work?jelmer112012-06-18 14:05:50
B
6
Posts: 17
Reputation: 448

Post » Mon Jun 18, 2012 11:52 pm

In theory should work, but if you want to be sure, try to test my .capx example
B
17
S
3
G
1
Posts: 28
Reputation: 1,763

Post » Tue Jun 19, 2012 6:32 am

[QUOTE=andorade] In theory should work, but if you want to be sure, try to test my .capx example[/QUOTE]

Thanks, i am testing it today.
B
6
Posts: 17
Reputation: 448

Post » Wed Jun 20, 2012 2:45 pm

I try to get web storage in my game, but it doesn't work. I have make a little web storage game. If you push space, Number add 1. If you push save, the number you are save with webstorage. But if you load it again, I get not a number, but NaN. What do I wrong?

Her is my game

Thanksjelmer112012-06-20 14:45:52
B
6
Posts: 17
Reputation: 448

Post » Wed Jun 20, 2012 3:58 pm

in the save action, remove the quotes from the second number

you have to save an integer and not a string because the global var is a integer(number) an not a string
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Wed Jun 20, 2012 5:03 pm

[QUOTE=vtrix] in the save action, remove the quotes from the second number

you have to save an integer and not a string because the global var is a integer(number) an not a string[/QUOTE]

Thanks!!! It works. I try to put it in my game.

EDIT: It works also in my game. Thanks.jelmer112012-06-20 17:14:18
B
6
Posts: 17
Reputation: 448

Post » Wed Jun 20, 2012 5:54 pm

[QUOTE=andorade] This example uses WebStorage.

Local storage is permanent until the user clears their cache. If the player plays the next day, local storage has the saved data.


https://dl.dropbox.com/u/12633239/level-webstorage.capx[/QUOTE]
when am i in third level and push f5, i start from first level(?)
B
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Artpunk, Magistross, Yahoo [Bot] and 28 guests